home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Games / Xconq 7.1.0 / src / xconq-7.1.0 / doc / refman.texi < prev    next >
Encoding:
Text File  |  1996-07-07  |  221.8 KB  |  6,581 lines  |  [TEXT/R*ch]

  1. @node Reference Manual
  2.  
  3. @chapter Reference Manual
  4.  
  5. This manual is the complete description of GDL.
  6. The style is somewhat terse; for more detail on how to
  7. use GDL to design games, see Chapter 3.
  8.  
  9. Please note that the current version of @i{Xconq} may not fully
  10. implement all of the constructs or combinations of constructs
  11. described here.  Any such omissions should be regarded as bugs.
  12.  
  13. @menu
  14. * Language Syntax::             
  15. * Game Module Forms::
  16. * World and Area Forms::
  17. * Side and Player Forms::
  18. * Unit Forms::
  19. * Agreements::
  20. * Scorekeeper Forms::
  21. * History Forms::
  22. * Battle Forms::
  23. * Types in General::
  24. * Unit Types::
  25. * Terrain Types::
  26. * Material Types::
  27. * Static Relationships Between Types::
  28. * Vision::
  29. * Game Initialization::
  30. * Synthesis Methods::
  31. * Setup Postprocessing::
  32. * Naming and Text Generation::
  33. * Actions::
  34. * Backdrop Environment Parameters::
  35. * Backdrop Economy Parameters::        
  36. * Random Events::
  37. * Dates and Time::
  38. * Image Families::
  39. * Other Forms::
  40. * Files and Directories::
  41. @end menu
  42.  
  43. @node Language Syntax, Game Module Forms, , Reference Manual
  44.  
  45. @section Language Syntax
  46.  
  47. GDL resembles Lisp, but instead of defining functions,
  48. the contents of a file declare
  49. certain objects (such as units and unit types) to exist,
  50. and specify values for their properties.
  51. In other words, GDL is @emph{nonprocedural}.
  52. This means that most of the time, you can list the various
  53. forms in any order you like.
  54. The main restriction is that any symbol, such as a variable
  55. or the name of a type, must be defined before it is used.
  56. Also, forms such as @code{set} and @code{add}, that set the
  57. value of a variable or property,
  58. always overwrite the previous data irreversibly, 
  59. so ordering of these is very important.
  60.  
  61. @menu
  62. * Lexical Elements::            
  63. * Conventions Used::            
  64. * Forms and Evaluation::        
  65. * Tables::                      
  66. * Modifying Objects::           
  67. * Symbols::                     
  68. * Lists::                       
  69. @end menu
  70.  
  71. @node Lexical Elements, Conventions Used, Language Syntax, Language Syntax
  72.  
  73. @subsection Lexical Elements
  74.  
  75. Numbers are introduced by a decimal digit, plus, or minus signs.
  76. They may contain only decimal digits, a decimal point, and be followed
  77. (immediately, no whitespace allowed) by a percent sign.
  78.  
  79. Strings are sequences of characters enclosed by doublequotes (@code{"}).
  80. They may contain any character except ASCII NUL (@code{'\0'}).
  81. To include a doublequote, use backslash, as in @code{"a \"quoted\" string"}.
  82. To include a nonprinting or eight-bit character,
  83. use backslash followed by three octal
  84. digits, which will be interpreted as an eight-bit character code.
  85. (This is mostly the same syntax as in C.)
  86. Note that game design files may be passed over networks
  87. and between different kinds of computer systems,
  88. so non-ASCII characters should not be inserted verbatim into strings.
  89.  
  90. Symbols are sequences of characters that don't
  91. include any of the other special characters.  If you wish to include such
  92. characters in a symbol, enclose it in vertical bars,
  93. for example @code{|foo bar|}.
  94. (The bars are not part of the symbol.)
  95. Symbols are case-sensitive,
  96. but this will be changed eventually.
  97.  
  98. Lists are a sequence of expressions enclosed in parentheses.
  99. The empty list is either @code{nil} or @code{()}.
  100. ``Dotted pairs'' are not allowed.
  101. Anything that is not a list is an @dfn{atom}.
  102.  
  103. All of these objects may range up to a very large size.
  104. (You may still run into bugs if you make strings or symbols
  105. over about 100 chars in length.)
  106.  
  107. Comments are enclosed either within @code{#| |#} (which nests properly,
  108. like Common Lisp and unlike C), or else extend from a semicolon
  109. @code{;} to the end of the line.  A comment is equivalent to whitespace,
  110. so @code{(a#|bcd|#e)} is the same as @code{(a e)}, not @code{(ae)}.
  111.  
  112. @code{#} by itself is a normal token.
  113.  
  114. True/false values
  115. are just the integers 0 and 1, with no special characteristics.
  116.  
  117. @deffn GlobalConstant @code{true}
  118. @end deffn
  119. @deffn GlobalConstant @code{false}
  120. These constants are symbolic forms for @code{1} and @code{0}.
  121. They are identical to numbers,
  122. but more descriptive for parameters that are boolean-valued.
  123. @end deffn
  124.  
  125. Unit, material, and terrain types are distinct objects.
  126. However, they can be considered to have numeric ``indices''
  127. assigned in order of the types' definition.  These numbers
  128. are not directly visible in GDL, but they often affect sorting
  129. and ordering.
  130.  
  131. You may also supply numbers as @var{dice specs}, which are used in several
  132. tables.  The syntax is the familiar @code{@var{nn}d@var{mm}[+@var{oo}]},
  133. where @var{nn} is the number of dice to throw, @var{mm} is the number of
  134. values on each die, and the optional @var{oo} is an value to be added to
  135. the result.  The die are 0-based, so for instance @code{3d6} yields values
  136. between 0 and 15, while @code{3d6+3} is equivalent to the result of rolling
  137. 3 6-sided dice.  The range of each value is severely limited; @var{nn}
  138. may range from 0 to 7, @var{mm} from 0 to 15, and @var{oo} from 0 to 127.
  139. Internally, dice specs are normal integers, in the range 16384 to 32767.
  140.  
  141. @node Conventions Used, Forms and Evaluation, Lexical Elements, Language Syntax
  142.  
  143. @subsection Conventions Used
  144.  
  145. Descriptions of values in this manual follow the conventions listed here.
  146.  
  147. For parameters described as @var{t/f},
  148. both @code{1}, @code{0} and @code{true}, @code{false} may be used.
  149. Parameters described as @var{n} and @var{n%} are numbers.
  150. Parameters described as @var{dist} or @var{length}
  151. are also numbers, but are in the unit of measure for lengths.
  152. Parameters described as @var{str} or @var{string} are strings.
  153.  
  154. Parameters described as
  155. @var{u} or @var{ui}, @var{m} or @var{mi}, and @var{t} or @var{ti},
  156. are values that must be unit, material, or terrain types, respectively.
  157.  
  158. Parameters described as @var{utype-value-list} match unit types with values.
  159. They can have several forms:
  160.  
  161. @itemize
  162. @item
  163. @code{(n1 n2 ...)} matches @code{n1} with type 0, etc in order.
  164. @item
  165. @code{((u1 n1) (u2 n2) ...)} evaluates @code{u1} to get a unit type,
  166. then matches it with @code{n1}.  @code{u1} etc may also be a list of
  167. types, in which case all the types get matched with @code{n1}.
  168. @end itemize
  169.  
  170. Other types of lists, such as those defined as @var{side-value-list},
  171. are interpreted similarly.  For all of these, multiple assignments to
  172. the same type etc will overwrite quietly.
  173.  
  174. List values described as @var{interpolation-list} are lists of pairs
  175. used to derive numerical values by interpolating between the listed
  176. values.  The form of an interpolation list is always
  177. @code{((key1 val1) (key2 val2) ...))}, where @var{keyi} and @var{vali}
  178. are numbers.
  179. If the input value @var{inp} to an interpolation matches @var{keyi}, the result
  180. value is @var{vali}.  If it is between @var{keyi} and @var{keyi+1}, then
  181. the result is gotten by linear interpolation, with the result value falling
  182. somewhere between @var{vali} and @var{vali+1}.
  183. Fractional values always round down.
  184. The @var{keyi} must occur in non-decreasing order; it is
  185. legitimate for two consecutive keys to be identical, in which the result
  186. value will be the value associated with the first key.
  187. If the input value is outside the domain specified by the keys,
  188. the result depends on the particular parameter; some will extrapolate
  189. in some appropriate fashion, while others will generate an error or warning.
  190.  
  191. Some values may be boolean expressions.  Boolean expressions are lists
  192. headed by the keywords @code{and}, @code{or}, and @code{not}, and may
  193. nest recursively.  For instance, the expression
  194. @example
  195. (and (or false (not false)) true)
  196. @end example
  197. is always true.  In some contexts, values other than @code{true} and
  198. @code{false} may appear, in which case the interpretation of those
  199. values depends on the context.
  200.  
  201. Some numeric values are @var{stochastic}, meaning that they are partly
  202. fixed and partly probabilistic in effect.  The most common form of this
  203. is values where the part > 100 is divided by 100, while the value mod 100
  204. is the probability to add 1 to the first part.  Thus a value of 425
  205. works out to a value of 4, 3/4 of the time, and to 5, 1/4 of the time,
  206. on average.
  207.  
  208. @node Forms and Evaluation, Tables, Conventions Used, Language Syntax
  209.  
  210. @subsection Forms and Evaluation
  211.  
  212. A @dfn{form} is either any single expression that appears in the file.
  213. A GDL file consists of a sequence of forms.
  214. Most forms of interest will be lists
  215. whose first element is a symbol identifying the form.
  216. For instance, a form beginning with the symbol @code{side}
  217. declares a side object.
  218. When the file containing such a form is read, @i{Xconq} will
  219. create a side object and fill in any properties as specified by the form.
  220. (Properties are like properties or attributes - most GDL objects
  221. have some.)
  222.  
  223. In most contexts, @i{Xconq} will @dfn{evaluate} an expression
  224. before using it, such as when filling in an object's property.
  225. Numbers and strings evaluate to themselves, while symbols
  226. evaluate to their bindings, as set by @code{set} or @code{define}.
  227. Lists evaluate to a list of the same length, but with all the elements
  228. evaluated, unless the first element of the list is a function.
  229. In that case,
  230. the remaining elements of the list are evaluated and given to the
  231. function, and its result will be the result.
  232.  
  233. @node Tables, Modifying Objects, Forms and Evaluation, Language Syntax
  234.  
  235. @subsection Tables
  236.  
  237. A @dfn{table} is a two-dimensional array of values indexed by types.
  238. Indices can be any pair of unit, material, or terrain type.
  239. The set of tables is fixed by @i{Xconq}, and all are described below.
  240.  
  241. @deffn Form @code{table} table-name items@dots{}
  242. This is the general form to fill in a table.
  243. The table named by @var{table-name} is filled in from the @var{items}.
  244. If an item is an atom, then every position in the
  245. table is filled in with that item, overwriting any
  246. previously-specified values.
  247. If an item is a list, it must be a three-element list
  248. of the form @code{(@var{type1} @var{type2} @var{value})}.
  249. If both @var{type1} and @var{type2} are single types,
  250. then @var{value} will be put into the table at the position
  251. indexed by the two types.
  252. If one of @var{type1} or @var{type2} evaluates to a list,
  253. @i{Xconq} will iterate over all members of the list while
  254. keeping the other type constant,
  255. while if both @var{type1} and @var{type2} are lists,
  256. then @i{Xconq} will iterate over all pairs from the two lists.
  257. The values used during iteration depend on whether the @var{value}
  258. is a list.  If @var{value} is an atom, then that value will just
  259. be used on every iteration.  If a list, then @i{Xconq} will
  260. use successive elements of the list while iterating.
  261.  
  262. If the first member of @var{items} is the symbol @code{add},
  263. then the rest of the items will add to the existing contents
  264. of the table rather than clearing to its default value first.
  265. @end deffn
  266.  
  267. The following forms are all equivalent:
  268. @example
  269. (table foo (a y 1) (b y 2) (c y 3) (a z 9) (b z 9) (c z 9))
  270.  
  271. (table foo ((a b c) y (1 2 3)) ((a b c) (z) 9))
  272.  
  273. (define v1 (a b c))
  274. (table foo (v1 y (1 2 3)) (v1 z 9))
  275.  
  276. (table foo ((a b c) (y z) ((1 2 3) (9 9 9))))
  277.  
  278. (table foo (a y 1) (b y 2) (c y 3))
  279. (table foo add ((a b c) z 9))
  280. @end example
  281.  
  282. @node Modifying Objects, Symbols, Tables, Language Syntax
  283.  
  284. @subsection Modifying Objects
  285.  
  286. Since forms normally define or create new objects,
  287. GDL defines the @code{add} form to modify existing objects.
  288.  
  289. @deffn Form @code{add} objects property new-values@dots{}
  290. This form evaluates the atom or list @var{objects} to arrive at the
  291. set of objects to be modified.
  292. Then it uses the @var{new-values} to write new data into
  293. the property named @var{property} of those objects.
  294. The @var{new-values} may be a single number or string, or a list.
  295. @end deffn
  296.  
  297. @node Symbols, Lists, Modifying Objects, Language Syntax
  298.  
  299. @subsection Symbols
  300.  
  301. Most of the symbols used in a game module are the predefined ones
  302. described in this manual.
  303. Others are attached to types when the types are defined,
  304. and still others name objects like units and sides.
  305. You can also define and set your own symbols to arbitrary values.
  306.  
  307. @deffn Form @code{define} symbol value
  308. This form defines the symbol @var{symbol} to be bound to the
  309. result of evaluating @var{value}.
  310. If @var{symbol} is already defined, @i{Xconq} will issue a warning,
  311. and ignore this form.
  312. @end deffn
  313.  
  314. @deffn Form @code{set} symbol value
  315. This form rebinds the already-bound symbol @var{symbol}
  316. to be bound to the result of evaluating @var{value}.
  317. If @var{symbol} is @emph{not} bound already,
  318. then @i{Xconq} will issue a warning, but proceed anyway.
  319. @end deffn
  320.  
  321. @deffn Form @code{undefine} symbol
  322. This form destroys any binding of the @var{symbol}.
  323. This is allowed for any symbol, including already-unbound symbols.
  324. @end deffn
  325.  
  326. @node Lists,  , Symbols, Language Syntax
  327.  
  328. @subsection Lists
  329.  
  330. @deffn Function @code{quote} form@dots{}
  331. This function prevents any evaluation of @var{form}.
  332. (This implies that the abovementioned evaluation of the argument
  333. list does @i{not} happen for this ``function''.)
  334. @end deffn
  335.  
  336. @deffn Function @code{list} form@dots{}
  337. This function makes a list out of all the @var{form}.
  338. @end deffn
  339.  
  340. @deffn Function @code{append} form@dots{}
  341. This function appends all the @var{form} (which may be
  342. lists or not) into a single list.  Non-lists will appear
  343. as though they were single-element lists.
  344. @end deffn
  345.  
  346. @deffn Function @code{remove} list1 list2
  347. This function removes the members of @var{list1} from @var{list2},
  348. returning the result.
  349. @end deffn
  350.  
  351. @node Game Module Forms, World and Area Forms, Language Syntax, Reference Manual
  352.  
  353. @section Game Module Forms
  354.  
  355. The game module declaration supplies information about the file as a whole.
  356. It is optional; if missing, @i{Xconq} will get the module's
  357. name from its file name, and supply defaults for the other properties.
  358.  
  359. @deffn Form @code{game-module} [ name ] properties@dots{}
  360. This form defines the properties of this game module.
  361. The optional @var{name} is a string that will be used to look up
  362. the module in libraries.
  363. If the @var{name} is supplied, then this form is considered to be the
  364. definition of the module, and overwrites any
  365. @code{game-module} form previously appearing in this file.
  366. If @var{name} is missing, then this form will modify the
  367. existing description of the module.
  368. Although are currently no restrictions enforced on the length or
  369. character set of a module name, @i{Xconq} may warn about a name
  370. that does not match the name of the file containing these forms;
  371. see @xref{Files and Directories} for more detail.
  372. @end deffn
  373.  
  374. @deffn ModuleProperty @code{title} string
  375. If defined, this property is the name by which the module will be displayed to
  376. players.  It is not used internally, so the name can be modified freely
  377. (unlike the module's name, which may appear in other modules).
  378. Defaults to the module's name. 
  379. @end deffn
  380.  
  381. @deffn ModuleProperty @code{blurb} string
  382. This property is a one-line description that users will see when they
  383. are deciding whether to play the module.
  384. It will be displayed without any modification:
  385. @example
  386. Welcome to my nightmare! (version 1.0 with stronger goblins)
  387. @end example
  388. Defaults to @code{""}.
  389. @end deffn
  390.  
  391. @deffn ModuleProperty @code{picture-name} string
  392. This property is the name of a picture that may be displayed along
  393. with the module's blurb, by those interfaces that support such pictures.
  394. Defaults to @code{""}.
  395. @end deffn
  396.  
  397. @deffn ModuleProperty @code{base-game} t/f
  398. @end deffn
  399.  
  400. @deffn ModuleProperty @code{instructions} strings@dots{}
  401. This property is a list of strings that are the instructions on how to play
  402. the game.  Defaults to @code{()}.
  403. @end deffn
  404.  
  405. @deffn ModuleProperty @code{notes} strings@dots{}
  406. This property is a list of strings comprising the set of
  407. detailed player's notes for the module.
  408. Both the list and each string in the list can be of any length.
  409. When displayed, the strings are all concatenated together, so the division
  410. into strings here is just for convenience.
  411. How these are displayed is up to the interface, but in general an empty
  412. string signals a new paragraph.
  413. Defaults to @code{()}.
  414. @end deffn
  415.  
  416. @deffn ModuleProperty @code{design-notes} strings@dots{}
  417. This property is a list of strings that are notes addressed to game designers.
  418. Defaults to @code{()}.
  419. @end deffn
  420.  
  421. @deffn ModuleProperty @code{version} string
  422. This property is the version of the module.
  423. Defaults to @code{""},
  424. which indicates that the module's version is undefined.
  425. @end deffn
  426.  
  427. @deffn ModuleProperty @code{program-version} versions
  428. This property dentifies @i{Xconq} versions for which this module
  429. is appropriate.
  430. If specified, then players will get a warning if they attempt to use this
  431. module with an inappropriate version of @i{Xconq}.
  432. Possible forms include a string, which allows the module only for
  433. exactly matching version of @i{Xconq},
  434. and @code{(@var{comparison} @var{version})},
  435. which allows versions satisfying the @var{comparison} test,
  436. which may only be @code{>=} or @code{<=}.
  437. So for instance
  438. @example
  439. (game-module "foo" (program-version (>= "7.0.3")))
  440. @end example
  441. is claimed to only work for versions 7.0.3 or later.
  442. Defaults to @code{""}, which means that the module is appropriate for
  443. any version of @i{Xconq}.
  444.  
  445. Notes that the @code{program-version} is strictly a heuristic to forewarn
  446. players; in practice it can be very difficult to know which modules work
  447. with which programs.  (The problems are similar to those encountered
  448. by programmers using different compiler versions on their programs.)
  449. @end deffn
  450.  
  451. @deffn ModuleProperty @code{base-module} name
  452. This property is the name of a module that must be loaded first.
  453. It is similar in effect to @code{include}.
  454. @end deffn
  455.  
  456. @deffn ModuleProperty @code{default-base-module} name
  457. This property specifies the name of a module that will be loaded
  458. if this module is given as the ``top-level'' module,
  459. such as via @code{-g} on a command line.
  460.  
  461. This is to prevent disasters when a library module that is
  462. used only by other modules is instead loaded as if it were
  463. a full game design.
  464. @end deffn
  465.  
  466. @deffn ModuleProperty @code{original-module} name
  467. @end deffn
  468. @deffn ModuleProperty @code{original-version} string
  469. @end deffn
  470. @deffn ModuleProperty @code{original-variants} list
  471. These properties record the module's name, version, and variant selections
  472. before a game save.  They are needed to record the game in the scorefile
  473. usefully.
  474. @end deffn
  475.  
  476. @menu
  477. * Module Variants::                    
  478. * Including Other Modules::     
  479. * Conditional Loading::         
  480. @end menu
  481.  
  482. @node Module Variants, Including Other Modules, Game Module Forms, Game Module Forms
  483.  
  484. @subsection Module Variants
  485.  
  486. Variants are options chosen by players at the start of a game.
  487. A generic variant includes information that will be used for displaying
  488. the choice to players, the acceptable range of choices, a default
  489. choice, and additional forms that may be evaluated if particular
  490. values were chosen.  Variant values are always numbers.
  491.  
  492. @deffn ModuleProperty @code{variants} items@dots{}
  493. This property defines named variants on this module.
  494. Variants appear as startup options for the game.
  495. The items have the form
  496. @code{([ @var{name} ] @var{type} [ @var{range/default} ] [ @var{clauses} ])}.
  497. The @var{name} is a string or symbol used to identify the choice to
  498. the players, the @var{type} says what sort of change is being enabled,
  499. @var{range/default} supplies a range of values and a default value
  500. among them,
  501. and @var{clauses} is a list of the form @code{(@var{value} @var{forms}@dots{}}.
  502. A game module may specify any number of variants.
  503. Defaults to @code{()}.
  504. @end deffn
  505.  
  506. A number of commonly useful variant types are predefined.
  507.  
  508. @deffn VariantType @code{world-size} [ width [ height [ circumf [ lat [ lon ] ] ] ] ] [ clauses ]
  509. This variant allows players to choose the size of the world.
  510. The sizes will default to the values in this variant's data.
  511. (@var{width} and @var{height} can be lists of the form @code{(lo dflt hi)},
  512. with the obvious interpretation??)
  513. @end deffn
  514.  
  515. @deffn VariantType @code{world-seen} [ dflt ] [ clauses ]
  516. This variant allows players to choose whether
  517. the terrain of the world will be known at the start of the game.
  518. The default setting will be the value @code{dflt},
  519. which may be either @code{true} or @code{false}.
  520. @end deffn
  521.  
  522. @deffn VariantType @code{see-all} [ dflt ] [ clauses ]
  523. This variant allows players to choose whether everything will be seen
  524. always, as with the global variable @code{see-all}.
  525. The default is set by @code{dflt}.
  526. @end deffn
  527.  
  528. @deffn VariantType @code{sequential} [ dflt ] [ clauses ]
  529. This variant allows players to choose whether to move
  530. simultaneously during a turn, or one at a time.
  531. The default is set by @var{dflt}.
  532. @end deffn
  533.  
  534. @deffn VariantType @code{real-time} [ total [ perside [ perturn ] ] ] [ clauses ]
  535. This variant allows players to choose realtime limits on the game.
  536. The value will default to the values in this variant's data.
  537. @c but what about upper/lower limits?
  538. @end deffn
  539.  
  540. @node Including Other Modules, Conditional Loading, Module Variants, Game Module Forms
  541.  
  542. @subsection Including Other Modules
  543.  
  544. You can include one game module in another.
  545.  
  546. @deffn Form @code{include} module-name [ variant-settings ]
  547. This form has the effect of inserting the contents
  548. of @var{module-name} into the current position in the module.
  549. @code{game-module} forms in the included module are not inserted,
  550. although they are remembered and may appear in displays.
  551. @i{Xconq} will fail completely if the included module cannot be found.
  552.  
  553. Unlike C etc, the same module cannot be included more than once; you will
  554. get a warning and the module will not be loaded.
  555. @end deffn
  556.  
  557. Note that the module names are not file names,
  558. so that system-specific features like directories and devices
  559. cannot be included.
  560. The mapping between module name and file name is interface-specific,
  561. so if you want to distribute a module, you should make sure all the
  562. module names don't have anything nonportable embedded.
  563. Alphanumeric characters and hyphens are guaranteed to be portable;
  564. mixed-case names are not.
  565.  
  566. @node Conditional Loading, , Including Other Modules, Game Module Forms
  567.  
  568. @subsection Conditional Loading
  569.  
  570. You can control which forms in a module are actually evaluated
  571. by using conditional loading.
  572.  
  573. @deffn Form @code{if} test-form sym
  574. @end deffn
  575. @deffn Form @code{else} sym
  576. @end deffn
  577. @deffn Form @code{end-if} sym
  578. If @var{test-form} evaluates to @code{true},
  579. then all subsequent forms, up until the matching @code{else}
  580. or @code{end-if}, will be evaluated.
  581. If @code{false}, then the forms will be read but not evaluated.
  582. All forms inside the conditional must be syntactically correct.
  583. @end deffn
  584.  
  585. @node World and Area Forms, Side and Player Forms, Game Module Forms, Reference Manual
  586.  
  587. @section World and Area Forms
  588.  
  589. The world consists of one @dfn{area},
  590. which is regular in shape and consists of a number of @dfn{cells}.
  591. Each cell has a type of terrain and a number of optional data values.
  592. Each kind of per-cell data will be called a @dfn{layer} of the area.
  593.  
  594. @deffn Form @code{world} [ circumference ] properties@dots{}
  595. This form defines the properties of the world as a whole.
  596. @end deffn
  597.  
  598. @deffn Form @code{area} [ width [ height ] ] [ restriction ] properties@dots{}
  599. This form defines the playing area of the world.
  600. The @var{restriction} identifies how to get data for this area from
  601. subsequent forms that are based on larger areas.
  602. @end deffn
  603.  
  604. @menu
  605. * World Properties::
  606. * Area Properties::
  607. * Layers::                      
  608. * Distances and Elevations::    
  609. * Temperatures::                
  610. * Winds::                       
  611. * Clouds::                      
  612. @end menu
  613.  
  614. @node World Properties, Area Properties, World and Area Forms, World and Area Forms
  615.  
  616. @subsection World Properties
  617.  
  618. @deffn WorldProperty @code{circumference} dist
  619. This property is the distance around the entire world (as a sphere).
  620. Default is @code{360}.
  621. @end deffn
  622.  
  623. @deffn WorldProperty @code{axial-tilt} n
  624. This property defines the extremes of seasonal changes.
  625. @end deffn
  626.  
  627. @node Area Properties, Layers, World Properties, World and Area Forms
  628.  
  629. @subsection Area Properties
  630.  
  631. @deffn AreaRestriction @code{restrict} w h x y
  632. This is a special subform that specifies that subsequent layers in an
  633. area of size w x h will be offset by x,y and then read into the
  634. actual area.  (This is useful for setting up a game that needs
  635. only a subset of a full map.)
  636.  
  637. Note that an area restriction is not a property, and must
  638. always appear before any properties in an area form.
  639. @end deffn
  640.  
  641. @deffn AreaProperty @code{width} n
  642. @end deffn
  643. @deffn AreaProperty @code{height} n
  644. These properties are the width and height of the world,
  645. as measured in cells.
  646. Allowable values range from 3x3
  647. up to 32767x32767, which is one billion cells!
  648. If only one of these is given, then the other defaults to the same value.
  649. If neither has been given, then they default to @code{60} and @code{30},
  650. respectively.
  651. @end deffn
  652.  
  653. In the case of a cylinder, the world wraps around
  654. in the x direction, and the width is the diameter of the cylinder,
  655. while the height is just the
  656. height in the usual sense.
  657. A hexagon world is flat on the top and bottom; its width is
  658. measured across the middle height, which is the largest span,
  659. and height is the same
  660. as for cylinders.  Here are some crude pictures, first of an 8x6 cylinder:
  661. @example
  662. # # # # # # # #
  663.  : : + + : : : :
  664. : : : + ^ : : :
  665.  : : : : : : : :
  666. : : : : ^ : : :
  667.  # # # # # # # #
  668. @end example
  669.  
  670. This world is an 8x7 hexagon:
  671. @example
  672.    # # # # # 
  673.   # : + + : #
  674.  # : : + ^ : #
  675. # : : + ^ : : #
  676.  # : : : : : #
  677.   # : : ^ : #
  678.    # # # # # 
  679. @end example
  680.  
  681. There are two kinds of properties that an area may have:
  682. scalar values such as latitude, 
  683. and layer values such as terrain and elevation.
  684.  
  685. @deffn AreaProperty @code{latitude} n
  686. This property is the offset, in cells, from the equator of the middle of the area
  687. (height / 2).
  688. Defaults to @code{0}.
  689. @end deffn
  690.  
  691. @deffn AreaProperty @code{longitude} n
  692. This property is the offset, in cells, from the ``Greenwich Meridian''
  693. of the world.
  694. Defaults to @code{0}.
  695. @end deffn
  696.  
  697. @node Layers, Distances and Elevations, Area Properties, World and Area Forms
  698.  
  699. @subsection Layers
  700.  
  701. @dfn{Layers} constitute the bulk of data about an area of the world.
  702. Each layer assigns a value to each cell in the area;
  703. examples include cell terrain, temperatures, elevations, and so forth.
  704. Since there may be many cells in a layer with the same values,
  705. each layer uses a common run-length encoding scheme.
  706. In this scheme, each horizontal band of cells
  707. is a separate text string, and the contents of the string encode
  708. individual numeric values, one for each cell.
  709. The encoding uses the characters @code{a..~} and @code{:..[}
  710. for 0 through 63,
  711. and decimal digits followed by commas (or the end of the string)
  712. for all other numbers.
  713. An optional @code{-} is allowed, and indicates a negative value.
  714. Runs of constant value are prefixed with their length, in decimal.
  715. The character @code{*} separates run lengths from values expressed
  716. as digits.
  717. Thus, the string
  718. @example
  719. "40adaa100,2*-99"
  720. @end example
  721. represents 46 values in all: 40 zeroes, a three, 2 more zeros, a 100,
  722. and two -99s.
  723. Although this format is quite unreadable,
  724. it has the advantages of compactness and portability;
  725. the expectation is that most layer editing will be done on-line.
  726. Note that the run encoding is entirely optional.
  727.  
  728. The following subforms at the beginning of layer data have special effects:
  729.  
  730. @deffn LayerSubform @code{constant} n
  731. This subform causes every value in the layer to be set to @var{n}.
  732. @end deffn
  733.  
  734. @deffn LayerSubform @code{subarea} x y w h
  735. This subform indicates that the layer data should be positioned at the given
  736. rectangle in the layer.
  737. @end deffn
  738.  
  739. @deffn LayerSubform @code{xform} mul add
  740. This subform has the effect of first multiplying the raw value by @var{mul},
  741. then adding @var{add} and storing the result into the layer.
  742. @end deffn
  743.  
  744. @deffn LayerSubform @code{by-bits}
  745. @end deffn
  746.  
  747. @deffn LayerSubform @code{by-char} str
  748. This subform specifies that the characters in @var{str} give the
  749. encodings of values in the layer.
  750. The first character in @var{str} encodes 0, the second encodes 1,
  751. and so forth.
  752. @end deffn
  753.  
  754. @deffn LayerSubform @code{by-name} name-list
  755. [what is the syntax of name-list exactly?]
  756. This subform is for generic worlds that are useful across multiple game designs.
  757. It has the syntax @code{((sym1 n1) (sym2 n2) ...)}, where @var{symi} is
  758. either a symbol or number that is the real value in the layer, and @var{ni}
  759. is the value used in the layer's encoding.
  760. For example, in the terrain layer,
  761. this allows for the matching of terrain types by name,
  762. so that if, say,
  763. the ``sea'' terrain type was type #0 in one game and type #4 in another,
  764. the world would have sea in all the same places after it was read in.
  765. In practice, only a few worlds are this general.
  766. If a value appears in the layer's data that is not listed,
  767. that value will simply go into the layer verbatim.
  768. @end deffn
  769.  
  770. @deffn AreaProperty @code{terrain} layer-data@dots{}
  771. This property is the actual layer of terrain types for cells.
  772. @end deffn
  773.  
  774. @deffn AreaProperty @code{aux-terrain} terrain-type layer-data@dots{}
  775. This property fills in values for borders, connections, and coatings.
  776. For border and connection terrain,
  777. the value is a six-bit number (0..63),
  778. with a bit turned on in each direction that there is a border
  779. or connection.
  780. For coating types, the value is the depth of the coating.
  781. @end deffn
  782.  
  783. @deffn AreaProperty @code{features} feature-list layer-data@dots{}
  784. This property specifies the nature and location of all geographical features.
  785. The @var{feature-list} is a list of lists, where each sublist has the form
  786. @code{([@var{id}] @var{typename} @var{name} [@var{super}])}
  787. where @var{id} is the numerical id referenced in the layer data
  788. (defaults to feature's position in the @var{feature-list}),
  789. @var{typename} is a symbol or string giving the general type of feature
  790. (such as @code{bay}),
  791. @var{name} is the name of the feature
  792. (such as @code{"Bay of Bengal"}),
  793. and @var{super} is the optional id of another feature that
  794. incorporates this feature.
  795. @end deffn
  796.  
  797. @deffn AreaProperty @code{material} material-type layer-data@dots{}
  798. This property declares the quantity of the given @var{material-type}
  799. in each cell of the area.
  800. @end deffn
  801.  
  802. @deffn AreaProperty @code{people-sides} layer-data@dots{}
  803. This property says which side the people of each cell are on.
  804. A @var{side-encoding} of @code{exact} assigns 0 to independence (no side),
  805. 1 to the first side, and so forth; otherwise, the encoding is a list
  806. of side names/ids and numbers.
  807. @end deffn
  808.  
  809. @node Distances and Elevations, Temperatures, Layers, World and Area Forms
  810.  
  811. @subsection Distances and Elevations
  812.  
  813. @deffn AreaProperty @code{elevations} layer-data@dots{}
  814. This property is the world elevation data itself.
  815. If any elevation falls outside the min/max elevation range
  816. for the terrain type of the cell, then it
  817. will be truncated appropriately.
  818. Defaults to @code{0} for each cell.
  819. @end deffn
  820.  
  821. @deffn AreaProperty @code{cell-width} dist
  822. This property is the distance across a single cell,
  823. expressed as units of elevation.  Defaults to @code{1}.
  824. @end deffn
  825.  
  826. @node Temperatures, Winds, Distances and Elevations, World and Area Forms
  827.  
  828. @subsection Temperatures
  829.  
  830. Each type of terrain has a temperature range in which it may be found.
  831. Any calculation that would fall outside this range will be clipped.
  832.  
  833. The temperature can be set to have a given value at a given elevation.
  834. All air temperatures will be interpolated appropriately.
  835.  
  836. @deffn GlobalVariable @code{temperature-floor} n
  837. This variable is the lowest possible temperature.
  838. Defaults to @code{0}.
  839. @end deffn
  840.  
  841. @deffn GlobalVariable @code{temperature-floor-elevation} n
  842. This variable is the elevation at which the temperature is always at
  843. @code{temperature-floor}.
  844. Defaults to @code{0}.
  845. @end deffn
  846.  
  847. @deffn AreaProperty @code{temperatures} layer-data@dots{}
  848. This property contains the temperature data itself.
  849. If any temperature falls outside the min/max temperature range, then it
  850. will be truncated appropriately.
  851. Defaults to @code{0} for each cell.
  852. @end deffn
  853.  
  854. @node Winds, Clouds, Temperatures, World and Area Forms
  855.  
  856. @subsection Winds
  857.  
  858. Winds are defined as having a nonnegative force and a direction.
  859.  
  860. @deffn AreaProperty @code{winds} layer-data@dots{}
  861. This property contains the force and direction of the prevailing
  862. winds in each cell.
  863. @end deffn
  864.  
  865. @node Clouds,  , Winds, World and Area Forms
  866.  
  867. @subsection Clouds
  868.  
  869. Cloud cover is defined as a layer over the terrain, with
  870. a bottom and top and density for each cell.
  871.  
  872. @deffn AreaProperty @code{clouds} layer-data@dots{}
  873. This property is the degree of cloud cover over each cell.
  874. A value of @code{0} corresponds to clear skies.
  875. @end deffn
  876.  
  877. @deffn AreaProperty @code{cloud-bottoms} layer-data@dots{}
  878. This property is the altitude above the ground of the bottoms
  879. of the clouds.
  880. @end deffn
  881.  
  882. @deffn AreaProperty @code{cloud-heights} layer-data@dots{}
  883. This property is the vertical thickness of the cloud cover
  884. in each cell.
  885. @end deffn
  886.  
  887. @node Side and Player Forms, Unit Forms, World and Area Forms, Reference Manual
  888.  
  889. @section Side and Player Forms
  890.  
  891. @deffn Form @code{side} [ id ] properties@dots{}
  892. This form has the effect of declaring a side to exist.
  893. If the number or symbol @var{id} is supplied and
  894. matches that of a side that has already been created,
  895. then the properties will modify the pre-existing side.
  896. Otherwise a new side object will be created,
  897. with a arbitrarily-chosen numeric id ranging between 1 and @code{sides-max}.
  898. If the given @var{id} is a symbol, then the side's numeric id will be
  899. bound to that symbol.
  900. @end deffn
  901.  
  902. @deffn GlobalVariable @code{sides-min} n
  903. @end deffn
  904. @deffn GlobalVariable @code{sides-max} n
  905. These variables are the minimum and maximum number of sides that may exist in
  906. a game.  Defaults are to @code{1} and the internal parameter @code{MAXSIDES},
  907. which is usually around 7.
  908. @code{MAXSIDES} can only be changed by recompiling @i{Xconq}.
  909. @end deffn
  910.  
  911. @deffn Form @code{side-defaults} properties@dots{}
  912. This form sets the defaults for all newly-created sides declared
  913. subsequently.
  914. These defaults will be set before the new side's properties are interpreted.
  915. This form has no effect on existing sides or on side declarations that
  916. modify existing sides.
  917. @end deffn
  918.  
  919. @menu
  920. * Side Name Properties::  
  921. * Side Class::                  
  922. * Status in Game::              
  923. * Side Relationships::          
  924. * Numbering Units::             
  925. * Side-Specific Namers::        
  926. * Side Tech Levels::                 
  927. * Side Views::                       
  928. * Interaction::                 
  929. * Doctrine::                    
  930. * Other::                       
  931. * Players::
  932. * Rules of Side Configuration::
  933. @end menu
  934.  
  935. @node Side Name Properties, Side Class, Side and Player Forms, Side and Player Forms
  936.  
  937. @subsection Side Name Properties
  938.  
  939. If the game design allows, all of these properties can be set at startup by
  940. the players (see <side config> and below).
  941. Omission of some of these results in suppression or substitution,
  942. depending on the interface and the situation.
  943. Omission of all name properties allows the side to go unmentioned,
  944. which is useful when the concept of ``side'' is useless or
  945. confusing to a player (as in some adventure games).
  946. All of these properties may be set at any time by any player.
  947.  
  948. @deffn SideProperty @code{name} str
  949. This property is the proper name of a side, as a country or alliance name.
  950. Examples include @code{"Axis"} and @code{"Hyperborea"}.
  951. Defaults to @code{""}.
  952. @end deffn
  953.  
  954. @deffn SideProperty @code{long-name} str
  955. This property is the long form of a side's name,
  956. as in @code{"People's Republic of Hyperborea"}.
  957. Defaults to be the same as the side's name.
  958. @end deffn
  959.  
  960. @deffn SideProperty @code{short-name} str
  961. This property is an short name or acronym for the side,
  962. often just the letters of the long name, as in @code{"PRH"}.
  963. Defaults to @code{""}.
  964. @end deffn
  965.  
  966. @deffn SideProperty @code{noun} str
  967. This property is the name of an individual unit or person
  968. belonging to the side.
  969. Defaults to @code{""}, which suppresses any mention of the side
  970. when (textually) describing the individual.
  971. @end deffn
  972.  
  973. @deffn SideProperty @code{plural-noun} str
  974. This property is what you would call a group of individuals.
  975. Defaults to the most common plural form of the @code{noun}
  976. (in English, the default pluralizer adds an ``s''),
  977. so any alternative plural noun, such as @code{"Chinese"},
  978. will need an explicit @code{plural-noun} value.
  979. @end deffn
  980.  
  981. @deffn SideProperty @code{adjective} str
  982. This property is an adjective that can be used of individuals on the side,
  983. as in @code{"Spanish"}.
  984. Defaults to @code{""}, which suppresses use of the adjective.
  985. @end deffn
  986.  
  987. As a complete example, a side named @code{"Poland"} would have a long name
  988. @code{"Kingdom of Poland"}, short name @code{"Po"},
  989. noun @code{"Pole"}, plural noun @code{"Poles"},
  990. and adjective @code{"Polish"}.
  991.  
  992. @deffn SideProperty @code{color} str
  993. This property is a comma-separated list of colors that represents the side.
  994. Defaults to @code{"black"}.
  995. @end deffn
  996.  
  997. @deffn SideProperty @code{emblem-name} str
  998. This property is the name of a graphical icon that represents the side.
  999. An emblem name of @code{"none"} suppresses any emblem display for the side.
  1000. Defaults to @code{""}, which gives the side a randomly-selected emblem.
  1001. @end deffn
  1002.  
  1003. @deffn SideProperty @code{names-locked} t/f
  1004. If the value of this property is @code{true},
  1005. then the player cannot modify any of the side's names.
  1006. Defaults to @code{false}.
  1007. @end deffn
  1008.  
  1009. @node Side Class, Status in Game, Side Name Properties, Side and Player Forms
  1010.  
  1011. @subsection Side Class
  1012.  
  1013. @deffn SideProperty @code{class} str
  1014. This property is a side's class, which is a keyword that characterizes the side.
  1015. Any number of sides may be in the same class.
  1016. Defaults to @code{""}.
  1017. @end deffn
  1018.  
  1019. @node Status in Game, Side Relationships, Side Class, Side and Player Forms
  1020.  
  1021. @subsection Status in Game
  1022.  
  1023. Once a side is in the game, it can never be totally removed.
  1024. However, sides can become inactive.
  1025.  
  1026. @deffn SideProperty @code{active} t/f
  1027. This property is @code{true} if the side is still actively participating in the game.
  1028. If the side has won, lost, or simply withdrew, this will be @code{false}.
  1029. Any units on a side not in the game are effectively frozen statues;
  1030. they don't do anything, and are untouchable by anyone else.
  1031. Defaults to @code{true}.
  1032. @end deffn
  1033.  
  1034. @deffn SideProperty @code{status} lose/draw/win
  1035. This property tells how this side did in the game.  Defaults to @code{draw}.
  1036. @end deffn
  1037.  
  1038. @deffn GlobalConstant @code{win}
  1039. @end deffn
  1040. @deffn GlobalConstant @code{draw}
  1041. @end deffn
  1042. @deffn GlobalConstant @code{lose}
  1043. These constants are the different possible values for a side's status.
  1044. @end deffn
  1045.  
  1046. @deffn SideProperty @code{ever-active} t/f
  1047. This property records if the side was ever active during the course of a game.
  1048. Sides that were never active (perhaps because they are used in some scenarios
  1049. of a game design but not others) will not be recorded in the scorefile.
  1050. @end deffn
  1051.  
  1052. @deffn SideProperty @code{advantage} n
  1053. @end deffn
  1054. @deffn SideProperty @code{advantage-min} n
  1055. @end deffn
  1056. @deffn SideProperty @code{advantage-max} n
  1057. Initial and min/max limits on advantage for the side.
  1058. All default to the values of the corresponding global variables.
  1059. @end deffn
  1060.  
  1061. @node Side Relationships, Numbering Units, Status in Game, Side and Player Forms
  1062.  
  1063. @subsection Side Relationships
  1064.  
  1065. By default, sides are neutral with respect to each other.
  1066.  
  1067. Control is a situation where one side
  1068. can observe and move another side's units, but not vice versa.
  1069. The controlling side can also just take the units of the controlled side.
  1070. If the controlled side loses or resigns, then the controlling side
  1071. automatically gets everything.
  1072. Both sides must agree to this relationship.
  1073.  
  1074. @deffn SideProperty @code{controlled-by} side
  1075. This property refers to the side controlling this one.
  1076. If 0, then the side is not under control.
  1077. Defaults to @code{0}.
  1078. @end deffn
  1079.  
  1080. The closest side relationship is one of trust.
  1081. A trusted side unit's may do anything at any time,
  1082. including entering and leaving units on the other side,
  1083. consuming the other side's materials, and so forth.
  1084.  
  1085. @deffn SideProperty @code{trusts} side-value-list
  1086. This property is true for any side that is trusted by this side.
  1087. Note that this relationship need not be symmetrical.
  1088. Defaults to @code{false} for all sides.
  1089. @end deffn
  1090.  
  1091. Note that these parameters apply only to relationships as enforced by
  1092. @i{Xconq}.  In an actual game, both human and robot sides can make agreements
  1093. and have positive/negative opinions about the other sides.
  1094.  
  1095. @deffn SideProperty @code{trades} side-value-list
  1096. This property defines the trading relationship with other sides.
  1097. Defaults to @code{0} for all sides.
  1098. @end deffn
  1099.  
  1100. @node Numbering Units, Side-Specific Namers, Side Relationships, Side and Player Forms
  1101.  
  1102. @subsection Numbering Units
  1103.  
  1104. @deffn SideProperty @code{next-numbers} utype-value-list
  1105. This property gives the next serial numbers that will be assigned to units
  1106. acquired by this side.
  1107. Defaults to @code{1} for each unit type (Dijkstra notwithstanding,
  1108. that's still where people start numbering things).
  1109. @end deffn
  1110.  
  1111. If the unit is of a type that gets numbered
  1112. (@code{assign-number} property is true),
  1113. then any unit of that type, acquired by any means whatsoever,
  1114. will be assigned the @code{next-numbers} value for that type
  1115. and @code{next-numbers} will be incremented.
  1116.  
  1117. @node Side-Specific Namers, Side Tech Levels, Numbering Units, Side and Player Forms
  1118.  
  1119. @subsection Side-Specific Namers
  1120.  
  1121. A side can have its own set of namers (see below)
  1122. that will be used for units
  1123. and geographical features associated with that side.
  1124.  
  1125. @deffn SideProperty @code{unit-namers} utype-value-list
  1126. This property specifies which namers will be used with which types
  1127. that the side starts out with or creates new units.
  1128. These will not be run automatically on captured units or gifts.
  1129. Defaults to @code{""} for each unit type.
  1130. @end deffn
  1131.  
  1132. @deffn SideProperty @code{feature-namers} feature-type-value-list
  1133. This property specifies which namers to use with which geographical
  1134. features in the side's initial country (if if has one).
  1135. Defaults to @code{()}.
  1136. @end deffn
  1137.  
  1138. @node Side Tech Levels, Side Views, Side-Specific Namers, Side and Player Forms
  1139.  
  1140. @subsection Side Tech Levels
  1141.  
  1142. The tech level of a side determines what it can do with each type of unit.
  1143.  
  1144. @deffn SideProperty @code{tech} utype-value-list
  1145. This property assigns a tech level to each unit type named.
  1146. Defaults to @code{0} for each unit type.
  1147. @end deffn
  1148.  
  1149. @deffn SideProperty @code{init-tech} utype-value-list
  1150. This property is the tech level at the beginning of the current turn.
  1151. Defaults to @code{0} for each unit type.
  1152. @end deffn
  1153.  
  1154. @node Side Views, Interaction, Side Tech Levels, Side and Player Forms
  1155.  
  1156. @subsection Side Views
  1157.  
  1158. These properties are necessary only if the relevant globals
  1159. are set a certain way (@code{see-all} is false, etc).
  1160.  
  1161. @deffn SideProperty @code{terrain-view} layer-data@dots{}
  1162. This property is the side's current knowledge of the world's terrain.
  1163. Defaults to @code{()}.
  1164. @end deffn
  1165.  
  1166. @deffn SideProperty @code{terrain-view-dates} layer-data@dots{}
  1167. This property is the dates of the side's current knowledge of the
  1168. world's terrain.
  1169. Defaults to @code{()}.
  1170. @end deffn
  1171.  
  1172. @deffn SideProperty @code{aux-terrain-view} ttype layer-data@dots{}
  1173. This property is the side's current knowledge of the world's aux terrain
  1174. of type @var{ttype}.
  1175. Defaults to @code{()}.
  1176. @end deffn
  1177.  
  1178. @deffn SideProperty @code{aux-terrain-view-dates} ttype layer-data@dots{}
  1179. This property is the dates of the side's current knowledge of the
  1180. world's aux terrain of type @var{ttype}.
  1181. Defaults to @code{()}.
  1182. @end deffn
  1183.  
  1184. @deffn SideProperty @code{unit-view} layer-data@dots{}
  1185. This property is the side's current knowledge of the world.
  1186. Defaults to @code{()}.
  1187. @end deffn
  1188.  
  1189. @deffn SideProperty @code{unit-view-dates} layer-data@dots{}
  1190. This property is the turn number at which the unit view data
  1191. in the corresponding cell of the @code{unit-view} was set.
  1192. Defaults to @code{()}.
  1193. @end deffn
  1194.  
  1195. @deffn SideProperty @code{material-view} mtype layer-data@dots{}
  1196. Defaults to @code{()}.
  1197. @end deffn
  1198.  
  1199. @deffn SideProperty @code{material-view-dates} ttype layer-data@dots{}
  1200. Defaults to @code{()}.
  1201. @end deffn
  1202.  
  1203. If the weather is not always known and up-to-date, then the
  1204. following properties what is known and when the information
  1205. was recorded.
  1206.  
  1207. @deffn SideProperty @code{temperature-view} layer-data@dots{}
  1208. Defaults to @code{()}.
  1209. @end deffn
  1210.  
  1211. @deffn SideProperty @code{temperature-view-dates} layer-data@dots{}
  1212. Defaults to @code{()}.
  1213. @end deffn
  1214.  
  1215. @deffn SideProperty @code{cloud-view} layer-data@dots{}
  1216. Defaults to @code{()}.
  1217. @end deffn
  1218.  
  1219. @deffn SideProperty @code{cloud-bottom-view} layer-data@dots{}
  1220. Defaults to @code{()}.
  1221. @end deffn
  1222.  
  1223. @deffn SideProperty @code{cloud-height-view} layer-data@dots{}
  1224. Defaults to @code{()}.
  1225. @end deffn
  1226.  
  1227. @deffn SideProperty @code{cloud-view-dates} layer-data@dots{}
  1228. Defaults to @code{()}.
  1229. @end deffn
  1230.  
  1231. @deffn SideProperty @code{wind-view} layer-data@dots{}
  1232. Defaults to @code{()}.
  1233. @end deffn
  1234.  
  1235. @deffn SideProperty @code{wind-view-dates} layer-data@dots{}
  1236. Defaults to @code{()}.
  1237. @end deffn
  1238.  
  1239. @node Interaction, Doctrine, Side Views, Side and Player Forms
  1240.  
  1241. @subsection Interaction
  1242.  
  1243. @deffn SideProperty @code{turn-time-used} seconds
  1244. This property is the number of (real) seconds
  1245. that this side has been moving units during the present turn.
  1246. Defaults to @code{0}.
  1247. @end deffn
  1248.  
  1249. @deffn SideProperty @code{total-time-used} seconds
  1250. This property is the number of (real) seconds that
  1251. this side has been moving units during the course of the game.
  1252. Defaults to @code{0}.
  1253. @end deffn
  1254.  
  1255. @deffn SideProperty @code{timeouts} n
  1256. This property is the number of ``time outs'' a side gets for the game.
  1257. Defaults to @code{0}.
  1258. @end deffn
  1259.  
  1260. @deffn SideProperty @code{timeouts-used} n
  1261. This property is the number of ``time outs'' a side has already used up.
  1262. Defaults to @code{0}.
  1263. @end deffn
  1264.  
  1265. @deffn SideProperty @code{finished-turn} t/f
  1266. This property is true if the side has declared that it is finished moving
  1267. things during this turn.
  1268. Defaults to @code{false}.
  1269. @end deffn
  1270.  
  1271. @deffn SideProperty @code{willing-to-draw} t/f
  1272. This property is true if the side will go along
  1273. with any other side that wants to end the game in a draw.
  1274. Defaults to @code{false}.
  1275. @end deffn
  1276.  
  1277. @node Doctrine, Other, Interaction, Side and Player Forms
  1278.  
  1279. @subsection Doctrine
  1280.  
  1281. Doctrines are objects that units consult to decide about individual behavior.
  1282.  
  1283. @deffn SideProperty @code{doctrines} utype-property-groups@dots{}
  1284. This property is the side's unit-type-specific doctrine.
  1285. Each @var{utype-property-group} has the form
  1286. @code{(@var{unit-types} doctrine)}.
  1287. Defaults to @code{()}.
  1288. @end deffn
  1289.  
  1290. @deffn SideProperty @code{doctrines-locked} t/f
  1291. This property says whether the docrine-unit type correspondence
  1292. for the side may be altered during the game.
  1293. This property does not control whether or not the properties
  1294. of the doctrines may be altered.
  1295. Defaults to @code{false}.
  1296. @end deffn
  1297.  
  1298. @deffn SideProperty @code{default-doctrine} doctrine-id
  1299. This property is the base doctrine that applies to all unit types
  1300. by default.
  1301. Defaults to @code{0}.
  1302. @end deffn
  1303.  
  1304. @deffn Form @code{doctrine} [ id ] properties@dots{}
  1305. This form creates a doctrine with the given id and properties.
  1306. @end deffn
  1307.  
  1308. @deffn DoctrineProperty @code{ever-ask-side} t/f
  1309. This property is the true if the unit may ask the player for what to do,
  1310. instead of picking some default activity.
  1311. @end deffn
  1312.  
  1313. @deffn DoctrineProperty @code{construction-run} type-value-list
  1314. This property is the default number of units to build when
  1315. construction has been requested.
  1316. @end deffn
  1317.  
  1318. @deffn DoctrineProperty @code{locked} t/f
  1319. This property is true if the properties of the doctrine
  1320. cannot be modified by the side's player during the game.
  1321. Defaults to @code{false}.
  1322. @end deffn
  1323.  
  1324. @node Other, Players, Doctrine, Side and Player Forms
  1325.  
  1326. @subsection Other
  1327.  
  1328. @deffn SideProperty @code{self-unit} unit
  1329. This property identifies a unit that represents the side itself.
  1330. The value may be a unit id, number, string, or symbol.
  1331. Defaults to @code{0}, which means that no unit represents the side.
  1332. See below for more details on self units.
  1333. @end deffn
  1334.  
  1335. @deffn SideProperty @code{priority} n
  1336. The order in which the side will get to act, relative to other sides
  1337. and to units.
  1338. Defaults to @code{0}.
  1339. @end deffn
  1340.  
  1341. @deffn SideProperty @code{scores} (skid val)@dots{}
  1342. This property is the current values of any numeric scores being
  1343. kept for the side.  It is a list of pairs of scorekeeper id and value.
  1344. Defaults to @code{()}.
  1345. @end deffn
  1346.  
  1347. @deffn SideProperty @code{attack-stats} n@dots{}
  1348. @end deffn
  1349. @deffn SideProperty @code{hit-stats} n@dots{}
  1350. These properties are the raw counts of attacks and hits, by attacking
  1351. and defending unit types.
  1352. Default to @code{}.
  1353. @end deffn
  1354.  
  1355. @deffn SideProperty @code{gain-counts} n@dots{}
  1356. @end deffn
  1357. @deffn SideProperty @code{loss-counts} n@dots{}
  1358. These properties are the raw counts of unit gains and losses,
  1359. organized by unit type and gain/loss reason.
  1360. Default to @code{0}.
  1361. @end deffn
  1362.  
  1363. @deffn Form @code{independent-units} properties@dots{}
  1364. Like the @code{side} form, but sets properties for independent units.
  1365. @end deffn
  1366.  
  1367. @deffn SideProperty @code{ui-data} data@dots{}
  1368. This property contains interface-specific data for the side.
  1369. This is mainly for preservation across game save/restores.
  1370. The property's value has the form
  1371. @code{((interface-type data) (interface-type data) ...)},
  1372. so that each interface can maintain its own data separately.
  1373. @end deffn
  1374.  
  1375. @deffn SideProperty @code{ai-data} data@dots{}
  1376. This property is information about the AIs associated with a side.
  1377. The property's value has the form
  1378. @code{((ai-type data) (ai-type data) ...)},
  1379. so that each type of AI can maintain its own data separately.
  1380. The form and meaning of each AI's data is specific to it alone.
  1381. Defaults to @code{()}.
  1382. @end deffn
  1383.  
  1384. @node Players, Rules of Side Configuration, Other, Side and Player Forms
  1385.  
  1386. @subsection Players
  1387.  
  1388. Player objects are rarely necessary when building game designs;
  1389. they typically only appear in saved games,
  1390. in order to ensure that the same players get the same sides
  1391. upon restoration.
  1392.  
  1393. @deffn SideProperty @code{player} id
  1394. This property is the unique identifier of a player that is running this side.
  1395. Defaults to @code{0}, which means that no player has been assigned
  1396. to the side.
  1397. @end deffn
  1398.  
  1399. @deffn Form @code{player} [ id ] properties@dots{}
  1400. This form defines a player.
  1401. If the @var{id} is supplied and matches the id of an existing player,
  1402. then the player object is updated using the @var{properties},
  1403. otherwise a new player object will be created,
  1404. using the given @var{id} if supplied, otherwise creating a new value.
  1405. @end deffn
  1406.  
  1407. @deffn GlobalVariable @code{player-sides-locked} t/f
  1408. This variable is @code{true} if the player/side assignment may not
  1409. be changed while the game is starting up.
  1410. Defaults to @code{false}.
  1411. @end deffn
  1412.  
  1413. The number of players must always be less than the number of sides
  1414. (sides without players just don't do anything).
  1415.  
  1416. @deffn PlayerProperty @code{name} str
  1417. This property identifies the player by name.
  1418. Defaults to @code{""}.
  1419. @end deffn
  1420.  
  1421. @deffn PlayerProperty @code{config-name} str
  1422. This property identifies a particular set of doctrine and other definitions
  1423. that the player is using.
  1424. Defaults to @code{""}.
  1425. @end deffn
  1426.  
  1427. @deffn PlayerProperty @code{display-name} str
  1428. This property identifies the display being used by the player's interface.
  1429. The interpretation of this value is dependent on the interface in use.
  1430. Defaults to @code{""}.
  1431. @end deffn
  1432.  
  1433. @deffn PlayerProperty @code{ai-type-name} str
  1434. This property is the type of AI that will play the side
  1435. if requested or necessary.
  1436. The set of choices depends on what has been compiled into @i{Xconq}.
  1437. (The general-purpose AI type @code{"mplayer"} will usually be available,
  1438. but is not guaranteed.)
  1439. An @code{ai-type-name} of @code{""} means that no AI will run this player.
  1440. Defaults to @code{""}.
  1441. @end deffn
  1442.  
  1443. @deffn PlayerProperty @code{password} str
  1444. This property is the encoding of a password that must be entered before this
  1445. player object can be reused successfully.
  1446. Defaults to @code{""}.
  1447. @end deffn
  1448.  
  1449. @deffn PlayerProperty @code{initial-advantage} n
  1450. This property is an initial relative strength at which the player should start.
  1451. Some synthesis methods can use this to give more units or some other
  1452. advantage to each player according to the requested strength.
  1453. Defaults to @code{1}.
  1454. @end deffn
  1455.  
  1456. @deffn GlobalVariable @code{advantage-min} n
  1457. @end deffn
  1458. @deffn GlobalVariable @code{advantage-max} n
  1459. @end deffn
  1460. @deffn GlobalVariable @code{advantage-default} n
  1461. These variables set the bounds and default values for players'
  1462. initial advantages.
  1463. Default to @code{1}, @code{9999}, and @code{1}, respectively.
  1464. @end deffn
  1465.  
  1466. @i{Xconq} is not guaranteed to be able to be able to set up a game
  1467. with any combination of player advantages;
  1468. the limits depend on the capabilities and characteristics of the
  1469. synthesis methods that use the requested advantages in their
  1470. calculations.
  1471.  
  1472. @node Rules of Side Configuration,  , Players , Side and Player Forms
  1473.  
  1474. @subsection Rules of Side Configuration
  1475.  
  1476. The properties of a side can come from a number of different sources
  1477. (here listed in order of precedence):
  1478.  
  1479. @itemize
  1480.  
  1481. @item
  1482. Interface-specific sources (X resources, Mac preferences).
  1483.  
  1484. @item
  1485. Game-specific form in player's configuration file.
  1486.  
  1487. @item
  1488. Generic form in player's configuration file.
  1489.  
  1490. @item
  1491. The @code{side} form for the side.
  1492.  
  1493. @item
  1494. The @code{side-defaults} form for the game.
  1495.  
  1496. @item
  1497. General program defaults.
  1498. @end itemize
  1499.  
  1500. Note that interface-specific and general config files can never alter
  1501. certain properties of a side, and can only alter others if they are
  1502. not locked.
  1503.  
  1504. @node Unit Forms, Agreements, Side and Player Forms, Reference Manual
  1505.  
  1506. @section Unit Forms
  1507.  
  1508. The basic @code{unit} form creates or modifies a unit.
  1509.  
  1510. @deffn Form @code{unit} id [ type ] properties@dots{}
  1511. This form defines a unit.
  1512. If a numeric @var{id} is supplied and matches the id of an existing unit,
  1513. then that unit will be modified by @var{properties},
  1514. and the optional @var{type} will be interpreted as a new type for the unit.
  1515. Otherwise a new unit will be created,
  1516. with either @var{id} as its id or
  1517. a arbitrarily-selected one if @var{id} is already in use.
  1518. If the unit's id is newly-generated and no type has been specified,
  1519. then type #0 (first-defined type) will be the type of the unit.
  1520. An id of @code{0} can never match an existing unit id, so effect
  1521. will be as if it had been omitted.
  1522. @end deffn
  1523.  
  1524. @deffn Form @var{unit-type-name} x y [ side-id ] properties@dots{}
  1525. This is an abbreviated form, in which
  1526. the x,y position is required, and an optional side id may be included.
  1527. The side id will come from @code{unit-defaults} if not specified.
  1528. The @var{unit-type-name} may be any valid unit type name or
  1529. defined name.
  1530. This form always results in a new unit.
  1531. @end deffn
  1532.  
  1533. Since there may be many units whose properties are similar, there
  1534. is a ``default unit'' whose properties fill in missing properties in
  1535. individual unit declarations.
  1536.  
  1537. @deffn Form @code{unit-defaults} [ modifier ] properties@dots{}
  1538. This form sets the default values for all subsequent units read in,
  1539. in this and every other module not yet loaded.
  1540. The set of defaults is additive,
  1541. so for instance you can repeatedly change the default side of units.
  1542. If the symbol @code{reset} has been supplied for the optional @var{modifier},
  1543. then all the defaults will be changed to the basic default
  1544. values, as described in this manual.
  1545. @end deffn
  1546.  
  1547. @deffn Symbol @code{reset}
  1548. This is the symbol used to reset unit defaults; see above.
  1549. @end deffn
  1550.  
  1551. @menu
  1552. * Unit Properties::             
  1553. * Unit Action State::           
  1554. * Unit Plan::                   
  1555. * Goal Types::                       
  1556. * Task Types::                  
  1557. @end menu
  1558.  
  1559. @node Unit Properties, Unit Action State, Unit Forms, Unit Forms
  1560.  
  1561. @subsection Unit Properties
  1562.  
  1563. This section lists properties of individual units.
  1564. In general, they default to the most common or reasonable values,
  1565. so need not always be specified, even in a saved game.
  1566.  
  1567. @deffn UnitProperty @code{@@} x y [ z ]
  1568. This property is the position of the unit.
  1569. Defaults to @code{-1,-1,0}, which causes the unit to be placed randomly.
  1570. The optional altitude @var{z} can also be set separately with
  1571. the property @code{z} below.
  1572. If @i{z} is even and the unit is in the open,
  1573. then the unit's altitude is @i{z/2};
  1574. if @i{z} is odd, then @i{(z-1)/2} is the type of connection terrain
  1575. that the unit is on.
  1576. @end deffn
  1577.  
  1578. @deffn UnitProperty @code{z} z
  1579. This property is identical to the optional z part of the @code{@@} property. 
  1580. Defaults to @code{0}.
  1581. @end deffn
  1582.  
  1583. @deffn UnitProperty @code{s} side
  1584. This property is the side of the unit.
  1585. It can be either a side name/noun/adjective (string) or id (number).
  1586. A value of @code{0} or @code{"independent"}
  1587. means that the unit is independent.
  1588. Defaults to @code{0}.
  1589. @end deffn
  1590.  
  1591. @deffn UnitProperty @code{os} side
  1592. This property is the original side of the unit.
  1593. It can be either a side name/noun/adjective (string) or id (number).
  1594. A value of @code{0} or @code{"independent"}
  1595. means that the unit is/was originally independent.
  1596. Defaults to the unit's actual side when first read in or created.
  1597. @end deffn
  1598.  
  1599. @deffn UnitProperty @code{#} n
  1600. This property is the unique numeric id of the unit.
  1601. Defaults to a game-selected value.
  1602. @end deffn
  1603.  
  1604. @deffn UnitProperty @code{n} str
  1605. This property is the name of the unit.
  1606. Defaults to @code{""}.
  1607. @end deffn
  1608.  
  1609. @deffn UnitProperty @code{nb} n
  1610. This property is the number of the unit,
  1611. which starts at @code{1} and goes up.
  1612. Defaults to @code{0}, which means that the unit is unnumbered.
  1613. @end deffn
  1614.  
  1615. @deffn UnitProperty @code{cp} n
  1616. This property is the current completeness of the unit.
  1617. If negative, indicates that the unit will appear at a time
  1618. and place specified by the @code{appear} x-property.
  1619. Defaults to the @code{cp-max} for the type.
  1620. @end deffn
  1621.  
  1622. @deffn UnitProperty @code{hp} n
  1623. This property is the current hit points of the unit.
  1624. Will be restricted to the range [0, hp-max].
  1625. An hp of 0 means that the unit is dead and will not appear in the game.
  1626. Defaults to @code{hp-max} for the unit's type.
  1627. @end deffn
  1628.  
  1629. @deffn UnitProperty @code{cxp} cxp
  1630. This property is the combat experience of the unit.
  1631. Defaults to @code{0}.
  1632. @end deffn
  1633.  
  1634. @deffn UnitProperty @code{mo} n
  1635. This property is the morale of the unit.
  1636. Defaults to @code{0}.
  1637. @end deffn
  1638.  
  1639. @deffn UnitProperty @code{m} mtype-value-list
  1640. This property is the amounts of supplies being carried by the unit.
  1641. Defaults to @code{0} for each material type.
  1642. @end deffn
  1643.  
  1644. @deffn UnitProperty @code{tp} utype-value-list
  1645. This property is the level of tooling to build each type of unit.
  1646. Defaults to @code{0} for each unit type.
  1647. @end deffn
  1648.  
  1649. @deffn UnitProperty @code{in} n
  1650. This property is the id of the unit's transport.
  1651. Defaults to @code{0}, meaning that unit is not in any transport.
  1652. @end deffn
  1653.  
  1654. @deffn UnitProperty @code{opinions} side-value-list@dots{}
  1655. This property is the unit's true feelings towards each side,
  1656. including its own side.
  1657. Defaults to @code{0} for each side.
  1658. @end deffn
  1659.  
  1660. @deffn UnitProperty @code{appear} n
  1661. This property is the turn on which a unit will appear.
  1662. The unit's cp must also be negative, and its position must be
  1663. negatives of its position.
  1664. Defaults to @code{-1}.
  1665. @end deffn
  1666.  
  1667. @deffn UnitProperty @code{disappear} n
  1668. This property is the turn on which a unit will disappear from
  1669. the game.  Occupants will be ejected if possible; otherwise
  1670. they will disappear also.
  1671. Defaults to @code{-1}.
  1672. @end deffn
  1673.  
  1674. @deffn UnitProperty @code{x} obj
  1675. This property is the optional extension properties of the unit.
  1676. Its value may be any object.
  1677. Defaults to @code{()}.
  1678. @end deffn
  1679.  
  1680. @node Unit Action State, Unit Plan, Unit Properties, Unit Forms
  1681.  
  1682. @subsection Unit Action State
  1683.  
  1684. @deffn UnitProperty @code{act} subprops
  1685. This property specifies the current action state of the unit.
  1686. @end deffn
  1687.  
  1688. @deffn UnitActionStateProperty @code{acp} n
  1689. This property is the number of action points left to the unit for this turn.
  1690. Defaults to @code{0}.
  1691. @end deffn
  1692.  
  1693. @deffn UnitActionStateProperty @code{acp0} n
  1694. This property is the initial number of action points for this turn,
  1695. computed at the beginning of the turn.
  1696. Defaults to @code{0}.
  1697. @end deffn
  1698.  
  1699. @deffn UnitActionStateProperty @code{aa} n
  1700. This property is the actual number of actions executed by the
  1701. unit so far in the current turn.
  1702. Defaults to @code{0}.
  1703. @end deffn
  1704.  
  1705. @deffn UnitActionStateProperty @code{am} n
  1706. This property is the actual number of moves (cell entries)
  1707. executed so far in the current turn.
  1708. Defaults to @code{0}.
  1709. @end deffn
  1710.  
  1711. @deffn UnitActionStateProperty @code{a} action
  1712. This property is the next action that the unit will perform.
  1713. @end deffn
  1714.  
  1715. Note that if any unit-defining form has an @code{act} property,
  1716. @i{Xconq} will start at an appropriate point in the middle of a turn,
  1717. giving all other units zero acp and mp,
  1718. rather than starting at the beginning of the turn
  1719. and computing acp and mp for all units.
  1720.  
  1721. @node Unit Plan, Goal Types, Unit Action State, Unit Forms
  1722.  
  1723. @subsection Unit Plan
  1724.  
  1725. @deffn UnitProperty @code{plan} type [ creation-turn ] properties@dots{}
  1726. This property describes the unit's current plan.
  1727. @end deffn
  1728.  
  1729. @deffn PlanType @code{none}
  1730. A unit with this type of plan does nothing.
  1731. It is used when a side has no player.
  1732. @end deffn
  1733.  
  1734. @deffn PlanType @code{passive}
  1735. This plan type is for units on a side that is being run directly
  1736. by the side.
  1737. @end deffn
  1738.  
  1739. @deffn PlanType @code{defensive}
  1740. This plan type is for units that defend areas or other units.
  1741. @end deffn
  1742.  
  1743. @deffn PlanType @code{offensive}
  1744. This plan type is for units that are to be aggressive.
  1745. @end deffn
  1746.  
  1747. @deffn PlanType @code{exploratory}
  1748. This plan type is for units that explore the world.
  1749. @end deffn
  1750.  
  1751. @deffn PlanType @code{random}
  1752. A unit with this plan type will act randomly.
  1753. @end deffn
  1754.  
  1755. @deffn PlanProperty @code{goal} goal
  1756. This property is the main goal of a unit's plan.
  1757. Defaults to @code{()}.
  1758. @end deffn
  1759.  
  1760. @deffn PlanProperty @code{formation} goal
  1761. This property is the formation goal of a unit's plan.
  1762. If defined, it is a position goal that the unit should
  1763. try to achieve when it is not trying to achieve the main goal.
  1764. Defaults to @code{()}.
  1765. @end deffn
  1766.  
  1767. @deffn PlanProperty @code{tasks} tasks@dots{}
  1768. This property is the complete task agenda for the unit's plan.
  1769. It is a list of tasks.
  1770. Defaults to @code{()}.
  1771. @end deffn
  1772.  
  1773. @deffn PlanProperty @code{asleep} t/f
  1774. This property is true if the unit is asleep.
  1775. Defaults to @code{false}.
  1776. @end deffn
  1777.  
  1778. @deffn PlanProperty @code{reserve} t/f
  1779. This property is true if the unit is in reserve.
  1780. Defaults to @code{false}.
  1781. @end deffn
  1782.  
  1783. @deffn PlanProperty @code{delayed} t/f
  1784. This property is true if the unit's activity
  1785. has been delayed until all others have acted.
  1786. Defaults to @code{false}.
  1787. @end deffn
  1788.  
  1789. @deffn PlanProperty @code{wait} t/f
  1790. This property is true if the unit is waiting for orders.
  1791. Defaults to @code{false}.
  1792. @end deffn
  1793.  
  1794. @deffn PlanProperty @code{ai-control} t/f
  1795. This property is true if the unit can be controlled by
  1796. any AI associated with the side.
  1797. Defaults to @code{true}.
  1798. @end deffn
  1799.  
  1800. @deffn PlanProperty @code{supply-alarm} t/f
  1801. This property is true if the unit should react when supply
  1802. is low.
  1803. Defaults to @code{false}.
  1804. @end deffn
  1805.  
  1806. @deffn PlanProperty @code{supply-is-low} t/f
  1807. This property is true if the unit considers its supply
  1808. to be low.
  1809. Defaults to @code{false}.
  1810. @end deffn
  1811.  
  1812. @deffn PlanProperty @code{wait-transport} t/f
  1813. This property is true if the unit is waiting for transport.
  1814. Defaults to @code{false}.
  1815. @end deffn
  1816.  
  1817. @deffn PlanProperty @code{initial-turn} turn
  1818. This property is the turn upon which a plan should go into effect.
  1819. Defaults to @code{0}.
  1820. @end deffn
  1821.  
  1822. @deffn PlanProperty @code{final-turn} turn
  1823. This property is the turn upon which a plan should be removed.
  1824. If the value is @code{0}, then the plan is not scheduled to
  1825. be removed.
  1826. Defaults to @code{0}.
  1827. @end deffn
  1828.  
  1829. @node Goal Types, Task Types, Unit Plan, Unit Forms
  1830.  
  1831. @subsection Goal Types
  1832.  
  1833. The possible types of goals are these:
  1834.  
  1835. @deffn GoalType @code{no-goal}
  1836. @end deffn
  1837.  
  1838. @deffn GoalType @code{won-game}
  1839. @end deffn
  1840.  
  1841. @deffn GoalType @code{lost-game}
  1842. @end deffn
  1843.  
  1844. @deffn GoalType @code{world-is-known}
  1845. @end deffn
  1846.  
  1847. @deffn GoalType @code{vicinity-is-known}
  1848. @end deffn
  1849.  
  1850. @deffn GoalType @code{positions-known}
  1851. @end deffn
  1852.  
  1853. @deffn GoalType @code{cell-is-occupied}
  1854. @end deffn
  1855.  
  1856. @deffn GoalType @code{vicinity-is-held}
  1857. @end deffn
  1858.  
  1859. @deffn GoalType @code{has-unit-type}
  1860. @end deffn
  1861.  
  1862. @deffn GoalType @code{has-unit-type-near}
  1863. @end deffn
  1864.  
  1865. @deffn GoalType @code{has-material-type}
  1866. @end deffn
  1867.  
  1868. @deffn GoalType @code{keep-formation}
  1869. @end deffn
  1870.  
  1871. @node Task Types,  , Goal Types, Unit Forms
  1872.  
  1873. @subsection Task Types
  1874.  
  1875. This section lists all the types of tasks that a unit may
  1876. perform.  Every task includes the two parameters @var{ex}
  1877. and @var{re}; the first is a record of how many times the
  1878. task has been executed, and the second records how many
  1879. times the task has failed.  (@i{Xconq} will retry a failed
  1880. task several times before abandoning it.)
  1881.  
  1882. @deffn TaskType @code{build} ex re u n n2 unit-id
  1883. This type of task directs the unit to build @var{n} units
  1884. of type @var{u}.  @var{n2} is the number already built
  1885. in the run and @var{unit-id} is the (optional) id of a
  1886. unit already being built.
  1887. @end deffn
  1888.  
  1889. @deffn TaskType @code{capture} ex re unit-id
  1890. @end deffn
  1891.  
  1892. @deffn TaskType @code{disband} ex re
  1893. This type of task directs the unit to disband itself.
  1894. @end deffn
  1895.  
  1896. @deffn TaskType @code{do-action} ex re n action
  1897. @end deffn
  1898.  
  1899. @deffn TaskType @code{hit-position} ex re x y z
  1900. This type of task directs the unit to attack or fire on
  1901. any unfriendly units at the given location.
  1902. @end deffn
  1903.  
  1904. @deffn TaskType @code{hit-unit} ex re unit-id
  1905. @end deffn
  1906.  
  1907. @deffn TaskType @code{move-dir} ex re dir n
  1908. This type of task directs the unit to move in direction
  1909. @var{dir} for a distance of @var{n} cells.
  1910. @end deffn
  1911.  
  1912. @deffn TaskType @code{move-to} ex re x y z dist
  1913. This type of task directs the unit to move to a distance of
  1914. no more than @var{dist} cells from the given location.
  1915. @end deffn
  1916.  
  1917. @deffn TaskType @code{occupy} ex re unit-id
  1918. This type of task directs the unit to attempt to enter
  1919. the given @var{unit-id}, moving adjacent to it first
  1920. if necessary.
  1921. @end deffn
  1922.  
  1923. @deffn TaskType @code{pickup} ex re unit-id
  1924. This type of task directs the unit to move towards
  1925. the given @var{unit-id}.
  1926. @end deffn
  1927.  
  1928. @deffn TaskType @code{repair} ex re unit-id
  1929. @end deffn
  1930.  
  1931. @deffn TaskType @code{resupply} ex re
  1932. This type of task directs the unit to replenish its supplies,
  1933. whether by doing more production or by moving to another
  1934. unit that has supplies available.
  1935. @end deffn
  1936.  
  1937. @deffn TaskType @code{sentry} ex re n
  1938. This task type directs the unit to stay where it is for
  1939. the next @var{n} turns.
  1940. @end deffn
  1941.  
  1942. @node Agreements, Scorekeeper Forms, Unit Forms, Reference Manual
  1943.  
  1944. @section Agreements
  1945.  
  1946. @deffn Form @code{agreement} [ id ] properties@dots{}
  1947. This form defines an agreement among a set of sides.
  1948. The name/id is a unique internal identifier.
  1949. @end deffn
  1950.  
  1951. @deffn AgreementProperty @code{type-name} str
  1952. This property is the name of the general type of agreement,
  1953. such a trade.
  1954. Defaults to @code{""}.
  1955. @end deffn
  1956.  
  1957. @deffn AgreementProperty @code{title} str
  1958. This property is the player-visible name of the agreement.
  1959. Defaults to @code{""}.
  1960. @end deffn
  1961.  
  1962. @deffn AgreementProperty @code{terms} forms@dots{}
  1963. This property is the list of terms of the agreement.
  1964. Defaults to @code{()}.
  1965. @end deffn
  1966.  
  1967. @deffn AgreementProperty @code{drafters} side-list
  1968. This property is the set of sides writing the agreement.
  1969. Only drafting sides may modify an agreement.
  1970. @end deffn
  1971.  
  1972. @deffn AgreementProperty @code{proposers} side-list
  1973. This property is the set of sides that initially proposed the agreement.
  1974. @end deffn
  1975.  
  1976. @deffn AgreementProperty @code{signers} side-list
  1977. Before the agreement is made,
  1978. this property is the proposed list of participants.
  1979. After the agreeement is made,
  1980. this is the actual list of participants.
  1981. @end deffn
  1982.  
  1983. @deffn AgreementProperty @code{willing-to-sign} side-list
  1984. This property is all the sides that have already agreed to this agreement,
  1985. on condition that all the other sides accept it.
  1986. @end deffn
  1987.  
  1988. @deffn AgreementProperty @code{known-to} side-list
  1989. This property is the set of sides that are to know about the
  1990. agreement when it is signed.
  1991. @end deffn
  1992.  
  1993. @deffn AgreementProperty @code{enforcement} form
  1994. @end deffn
  1995.  
  1996. @deffn AgreementProperty @code{state} state
  1997. @end deffn
  1998.  
  1999. @node Scorekeeper Forms, History Forms, Agreements, Reference Manual
  2000.  
  2001. @section Scorekeeper Forms
  2002.  
  2003. Scorekeepers are the objects that manage scoring, winning, and losing.
  2004. A game design need not define any scorekeepers,
  2005. and none are created by default.
  2006. A scorekeeper may either maintain a numeric score that is used at
  2007. the end of the game to decide rankings, or simply declare a side
  2008. to have won or lost.
  2009.  
  2010. @deffn Form @code{scorekeeper} name properties@dots{}
  2011. This form creates or modifies a scorekeeper with the given @var{name},
  2012. with the given @var{properties}.
  2013. @end deffn
  2014.  
  2015. @menu
  2016. * Scorekeeper Properties::
  2017. * Scorekeeper Bodies::                      
  2018. * Scorekeeper Functions::       
  2019. * Scorefile::                   
  2020. @end menu
  2021.  
  2022. @node Scorekeeper Properties, Scorekeeper Bodies, , Scorekeeper Forms
  2023.  
  2024. @subsection Scorekeeper Properties
  2025.  
  2026. @deffn ScorekeeperProperty @code{title} str
  2027. This property is a string that identifies the scorekeeper to the players.
  2028. Defaults to @code{""}.
  2029. @end deffn
  2030.  
  2031. @deffn ScorekeeperProperty @code{when} (type [ exp ])
  2032. This property is when the scorekeeper will be checked or updated.
  2033. Defaults to @code{after-turn}.
  2034. @end deffn
  2035.  
  2036. @deffn ScorekeeperWhenType @code{before-turn} exp
  2037. This indicates that the scorekeeper will run at the start of each turn
  2038. matching @var{exp}, or after every turn if @var{exp} is not given.
  2039. @end deffn
  2040.  
  2041. @deffn ScorekeeperWhenType @code{after-turn} exp
  2042. This indicates that the scorekeeper will run at the end of each turn
  2043. matching @var{exp}, or after every turn if @var{exp} is not given.
  2044. @end deffn
  2045.  
  2046. @deffn ScorekeeperWhenType @code{after-event} exp
  2047. This indicates that the scorekeeper will run after every event
  2048. matching @var{exp}, or after every event if @var{exp} is not given.
  2049. @end deffn
  2050.  
  2051. @deffn ScorekeeperWhenType @code{after-action} exp
  2052. This indicates that the scorekeeper will run at the end of each action
  2053. matching @var{exp}, or after every action if @var{exp} is not given.
  2054. @end deffn
  2055.  
  2056. @deffn ScorekeeperProperty @code{applies-to} side-list
  2057. This property is the set of sides or side classes
  2058. to which the scorekeeper applies.
  2059. Scorekeepers apply only to sides that are in the game.
  2060. Defaults to @code{side*}. 
  2061. @end deffn
  2062.  
  2063. @deffn ScorekeeperProperty @code{known-to} side-list
  2064. This property is the list of sides that know about this scorekeeper,
  2065. and can see the value of the score for each side that it applies to.
  2066. Defaults to @code{side*}. 
  2067. @end deffn
  2068.  
  2069. @deffn ScorekeeperProperty @code{trigger} form
  2070. This property is an expression that is true when it is time
  2071. to start checking the scorekeeper's main test.
  2072. Once a scorekeeper is triggered, it remains active.
  2073. Defaults to @code{false}.
  2074. @end deffn
  2075.  
  2076. @deffn ScorekeeperProperty @code{triggered} t/f
  2077. This property is true if the scorekeeper is currently triggered.
  2078. Defaults to @code{true}.
  2079. @end deffn
  2080.  
  2081. @deffn ScorekeeperProperty @code{do} forms@dots{}
  2082. This property is a list of forms to execute in order
  2083. each time the scorekeeper runs.
  2084. Defaults to @code{()}.
  2085. @end deffn
  2086.  
  2087. @deffn ScorekeeperProperty @code{messages} forms@dots{}
  2088. This property is a list of messages to send when
  2089. their conditions are satisfied.
  2090. Defaults to @code{()}.
  2091. @end deffn
  2092.  
  2093. @deffn ScorekeeperProperty @code{initial} value
  2094. This property is the value of the score upon game startup.
  2095. If this value is @code{-9999},
  2096. the scorekeeper does not maintain a numeric score.
  2097. Defaults to @code{-9999}.
  2098. @end deffn
  2099.  
  2100. @node Scorekeeper Bodies, Scorekeeper Functions, Scorekeeper Properties, Scorekeeper Forms
  2101.  
  2102. @subsection Scorekeeper Bodies
  2103.  
  2104. The forms in the body (the @code{do} property) of the scorekeeper
  2105. may be any of the forms listed here.
  2106.  
  2107. @deffn ScorekeeperForm @code{last-side-wins}
  2108. If supplied as the only symbol in the body, then the scorekeeper
  2109. implements the usual ``last side left in the game wins'' behavior.
  2110. @end deffn
  2111.  
  2112. @deffn ScorekeeperForm @code{if} test action
  2113. If the @i{test} evaluates to @code{true} or any nonzero number,
  2114. then the @i{action} will be done.
  2115. @end deffn
  2116.  
  2117. @deffn ScorekeeperForm @code{cond} (test actions@dots{}) @dots{}
  2118. This is like Lisp's cond.
  2119. @end deffn
  2120.  
  2121. @deffn ScorekeeperForm @code{stop} [ message ]
  2122. This stops the game immediately, with a draw for all sides.
  2123. @end deffn
  2124.  
  2125. @deffn ScorekeeperForm @code{win} [ sides ] [ own-message ] [ other-message ]
  2126. @end deffn
  2127.  
  2128. @deffn ScorekeeperForm @code{lose} [ sides ] [ own-message ] [ other-message ]
  2129. @end deffn
  2130.  
  2131. @deffn ScorekeeperForm @code{end} [ message ]
  2132. This scorekeeper action ends the game immediately.
  2133. @end deffn
  2134.  
  2135. @deffn ScorekeeperForm @code{add} exp [ side ]
  2136. This adds the result of evaluating @var{exp} to the score of the given side.
  2137. The value may be a negative number.
  2138. @end deffn
  2139.  
  2140. @node Scorekeeper Functions, Scorefile, Scorekeeper Bodies, Scorekeeper Forms
  2141.  
  2142. @subsection Scorekeeper Functions
  2143.  
  2144. @deffn ScorekeeperFunction @code{and} exps
  2145. @end deffn
  2146.  
  2147. @deffn ScorekeeperFunction @code{or} exps
  2148. @end deffn
  2149.  
  2150. @deffn ScorekeeperFunction @code{not} exp
  2151. @end deffn
  2152.  
  2153. @deffn ScorekeeperFunction @code{=} exp1 exp2
  2154. @end deffn
  2155.  
  2156. @deffn ScorekeeperFunction @code{/=} exp1 exp2
  2157. @end deffn
  2158.  
  2159. @deffn ScorekeeperFunction @code{>} exp1 exp2
  2160. @end deffn
  2161.  
  2162. @deffn ScorekeeperFunction @code{>=} exp1 exp2
  2163. @end deffn
  2164.  
  2165. @deffn ScorekeeperFunction @code{<} exp1 exp2
  2166. @end deffn
  2167.  
  2168. @deffn ScorekeeperFunction @code{<=} exp1 exp2
  2169. @end deffn
  2170.  
  2171. @deffn ScorekeeperFunction @code{sum} types properties [ test ]
  2172. @end deffn
  2173.  
  2174. @node Scorefile,  , Scorekeeper Functions, Scorekeeper Forms
  2175.  
  2176. @subsection Scorefile
  2177.  
  2178. @deffn GlobalVariable @code{scorefile-name} str
  2179. This variable supplies the name of the file to be used for recording
  2180. scores of people playing the game.
  2181. The default value is @code{""}, which disables the recording of scores.
  2182. @end deffn
  2183.  
  2184. @node History Forms, Battle Forms, Scorekeeper Forms, Reference Manual
  2185.  
  2186. @section History Forms
  2187.  
  2188. All the important events in a game are logged into a history.
  2189.  
  2190. @deffn Form @code{evt} date type sides data
  2191. This form creates a single historical event.
  2192. The @var{date} is the turn of the event's occurrence, while
  2193. the @var{sides} is a bit mask of sides that know about the
  2194. event, or @code{all} if all sides know about it.
  2195. @end deffn
  2196.  
  2197. @deffn GlobalConstant @code{all}
  2198. @end deffn
  2199.  
  2200. @deffn Form @code{exu} id type x y side props
  2201. This form defines an ``ex-unit'', which is a record of a unit that
  2202. existed previously.  It is similar to a unit, but has only a few
  2203. properties; type, id, position, side, name, and number.
  2204. Property names and semantics are nearly identical to their
  2205. counterparts for units.
  2206. @end deffn
  2207.  
  2208. @deffn EventType @code{log-started}
  2209. This event records when the recording of events began.
  2210. Multiple instances of this may occur, for instance if
  2211. logging were to be turned off and then on again.
  2212. @end deffn
  2213.  
  2214. @deffn EventType @code{log-ended}
  2215. @end deffn
  2216.  
  2217. @deffn EventType @code{game-started}
  2218. This event records the actual start of the game.
  2219. There should only be one in a game's history.
  2220. @end deffn
  2221.  
  2222. @deffn EventType @code{game-saved}
  2223. This event records that the game was saved.
  2224. @end deffn
  2225.  
  2226. @deffn EventType @code{game-restarted}
  2227. This event records that the game was restored and restarted from
  2228. a saved game.
  2229. @end deffn
  2230.  
  2231. @deffn EventType @code{game-ended}
  2232. @end deffn
  2233.  
  2234. @deffn EventType @code{side-joined} side
  2235. This event records when a side joined the game.
  2236. @end deffn
  2237.  
  2238. @deffn EventType @code{side-lost} side scorekeeper
  2239. This event records when a side lost.
  2240. @end deffn
  2241.  
  2242. @deffn EventType @code{side-won} side scorekeeper
  2243. This event records when a side won.
  2244. @end deffn
  2245.  
  2246. @deffn EventType @code{side-withdrew} side
  2247. This event records when a side withdrew from the game.
  2248. @end deffn
  2249.  
  2250. @deffn EventType @code{unit-created} side unit
  2251. This event records the creation of a unit.
  2252. @end deffn
  2253.  
  2254. @deffn EventType @code{unit-completed} side unit
  2255. This event records the completion of a unit.
  2256. @end deffn
  2257.  
  2258. @deffn EventType @code{unit-acquired}
  2259. This event records the acquisition of a unit,
  2260. for instance as a gift from another side.
  2261. @end deffn
  2262.  
  2263. @deffn EventType @code{unit-captured}
  2264. This event records the capture of a unit,
  2265. as an outcome of combat or from a direct attempt to capture.
  2266. @end deffn
  2267.  
  2268. @deffn EventType @code{unit-moved} unit x1 y1 x2 y2
  2269. This event records the movement of a unit.
  2270. @end deffn
  2271.  
  2272. @deffn EventType @code{unit-name-changed} unit1 unit2
  2273. This event records that a unit's name was changed.
  2274. @var{unit1} will be an ex-unit representing the unit
  2275. under its previous name.
  2276. @end deffn
  2277.  
  2278. @deffn EventType @code{unit-type-changed} unit1 unit2
  2279. This event records that a unit's type was changed.
  2280. @var{unit1} will be an ex-unit representing the unit
  2281. with its previous type.
  2282. @end deffn
  2283.  
  2284. @deffn EventType @code{unit-assaulted} unit1 unit2 x y
  2285. @end deffn
  2286.  
  2287. @deffn EventType @code{unit-damaged} unit hp1 hp2
  2288. @end deffn
  2289.  
  2290. @deffn EventType @code{unit-killed} unit
  2291. @end deffn
  2292.  
  2293. @deffn EventType @code{unit-died-in-accident} unit
  2294. @end deffn
  2295.  
  2296. @deffn EventType @code{unit-died-from-temperature} unit
  2297. @end deffn
  2298.  
  2299. @deffn EventType @code{unit-vanished} unit
  2300. @end deffn
  2301.  
  2302. @deffn EventType @code{unit-wrecked} unit
  2303. @end deffn
  2304.  
  2305. @deffn EventType @code{unit-wrecked-in-accident} unit
  2306. @end deffn
  2307.  
  2308. @deffn EventType @code{unit-revolted} unit
  2309. @end deffn
  2310.  
  2311. @deffn EventType @code{unit-surrendered} unit
  2312. @end deffn
  2313.  
  2314. @deffn EventType @code{unit-garrisoned} unit
  2315. @end deffn
  2316.  
  2317. @deffn EventType @code{unit-disbanded} unit
  2318. @end deffn
  2319.  
  2320. @deffn EventType @code{unit-starved} unit
  2321. @end deffn
  2322.  
  2323. @deffn EventType @code{unit-left-world} unit
  2324. @end deffn
  2325.  
  2326. The following event types are the results of actions.
  2327.  
  2328. @deffn EventType @code{action-ok}
  2329. @end deffn
  2330.  
  2331. @deffn EventType @code{action-error}
  2332. @end deffn
  2333.  
  2334. @deffn EventType @code{cannot-do}
  2335. @end deffn
  2336.  
  2337. @deffn EventType @code{insufficient-acp}
  2338. @end deffn
  2339.  
  2340. @deffn EventType @code{insufficient-material}
  2341. @end deffn
  2342.  
  2343. @deffn EventType @code{too-far}
  2344. @end deffn
  2345.  
  2346. @deffn EventType @code{too-near}
  2347. @end deffn
  2348.  
  2349. @deffn EventType @code{action-done}
  2350. @end deffn
  2351.  
  2352. @deffn EventType @code{insufficient-mp}
  2353. @end deffn
  2354.  
  2355. @deffn EventType @code{cannot-leave-world}
  2356. @end deffn
  2357.  
  2358. @deffn EventType @code{destination-full}
  2359. @end deffn
  2360.  
  2361. @deffn EventType @code{overrun-succeeded}
  2362. @end deffn
  2363.  
  2364. @deffn EventType @code{overrun-failed}
  2365. @end deffn
  2366.  
  2367. @deffn EventType @code{capture-succeeded}
  2368. @end deffn
  2369.  
  2370. @deffn EventType @code{capture-failed}
  2371. @end deffn
  2372.  
  2373. @deffn EventType @code{fire-into-outside-world}
  2374. @end deffn
  2375.  
  2376. @node Battle Forms, Types in General, History Forms, Reference Manual
  2377.  
  2378. @section Battle Forms
  2379.  
  2380. Battles always have exactly two ``sides'', referred to as
  2381. the attacker-list or A-list and the defender-list or D-list, so
  2382. as not to confuse them with sides in the game.
  2383.  
  2384. @deffn Form @code{battle} a-list d-list@dots{}
  2385. @end deffn
  2386.  
  2387. Each list has the form
  2388. @example
  2389. ((<unit> <commitment>) ...)
  2390. @end example
  2391.  
  2392. @node Types in General, Unit Types, Battle Forms, Reference Manual
  2393.  
  2394. @section Types in General
  2395.  
  2396. Types are the foundation of @i{Xconq} game designs.
  2397. Nearly all the rules and game parameters are associated
  2398. with the unit, material, and terrain types.
  2399. There is no sort of type hierarchy; instead, most forms allow sets of types
  2400. to be used in the place of single types.
  2401.  
  2402. Each type has an index associated with it, starting from 0.
  2403. This index never appears directly, and cannot be set.
  2404. This does mean that types have an order, so the order in which
  2405. types are defined is sometimes significant.
  2406. These cases will be noted.
  2407. The order is always the order in which the types appear in the file.
  2408.  
  2409. @menu
  2410. * Type Names::                      
  2411. * Type Images::                     
  2412. * Documentation::               
  2413. * Availability::                
  2414. * Type Extension::              
  2415. @end menu
  2416.  
  2417. @node Type Names, Type Images, Types in General, Types in General
  2418.  
  2419. @subsection Type Names
  2420.  
  2421. The names of types need not be distinct from each other,
  2422. but you run the risk of player confusion if they share names.
  2423.  
  2424. @deffn TypeProperty @code{name} string
  2425. This property is the specific name of the type.
  2426. This name will be displayed to players; the exact format
  2427. is up to the interface, but will typically
  2428. depend on the name's length and the space available in the display.
  2429. If no type names have been defined, the internal type name (see below)
  2430. will be used.
  2431. Defaults to @code{""}.
  2432. @end deffn
  2433.  
  2434. @deffn TypeProperty @code{long-name} string
  2435. This property is a fully spelled-out name for the type.
  2436. Defaults to @code{""}.
  2437. @end deffn
  2438.  
  2439. @deffn TypeProperty @code{short-name} string
  2440. This property is an abbreviated name of r
  2441. Defaults to @code{""}.
  2442. @end deffn
  2443.  
  2444. @deffn TypeProperty @code{generic-name} string
  2445. This property is like @code{name}, but identifies the type less specifically,
  2446. and several types may have the same generic name.
  2447. If no generic names are defined, then the regular type names will be used.
  2448. This is useful when making abbreviated lists, so that related types
  2449. get counted together.
  2450. Defaults to @code{()}.
  2451. @end deffn
  2452.  
  2453. As an example of the distinction between type names and generic type name,
  2454. the names of a automobile type might be @code{"1965 Mustang"},
  2455. @code{"Mustang"}, and @code{"M"},
  2456. while the generic name is @code{"auto"}.
  2457. Then the interface could choose to display a parking lot as containing
  2458. either @code{"4 auto"} or @code{"2 Mustang 1 Edsel 1 Jeep"}.
  2459.  
  2460. Note that names specified as properties are strings only, and are
  2461. not defined as evaluable symbols.
  2462.  
  2463. @node Type Images, Documentation, Type Names, Types in General
  2464.  
  2465. @subsection Type Images
  2466.  
  2467. The interpretation of these properties is entirely up to each interface;
  2468. see the appropriate interface documentation for details.
  2469.  
  2470. @deffn TypeProperty @code{image-name} str
  2471. This property is the name of the type's image.
  2472. If undefined or unusable for some reason,
  2473. the interface will display the type in some default manner, such as
  2474. a solid-color square or a string.
  2475. @end deffn
  2476.  
  2477. For example, in X11,
  2478. the name might be the name of a file in the usual bitmap format, as
  2479. produced by the @var{bitmap} program.  The actual file name is produced
  2480. by appending @code{".b"}.
  2481. (The situation in X is actually more complicated than this.)
  2482. See the interface documentation for details on how the interface
  2483. uses the image.
  2484.  
  2485. @deffn TypeProperty @code{color} str
  2486. This property is the name of the preferred color for this type.
  2487. Both normal color names and the strings @code{"bg"} and @code{"fg"}
  2488. (meaning ``foreground color'' and ``background color'')
  2489. may be used.
  2490. If the image is in color, then this property has no effect.
  2491. Defaults to @code{"fg"}.
  2492. @end deffn
  2493.  
  2494. @deffn TypeProperty @code{char} str
  2495. This property supplies a single character for this type
  2496. (all characters after the first one in @var{str} are ignored).
  2497. Defaults to @code{""}.
  2498. @end deffn
  2499.  
  2500. @node Documentation, Availability, Type Images, Types in General
  2501.  
  2502. @subsection Documentation
  2503.  
  2504. @deffn TypeProperty @code{description-format} list@dots{}
  2505. This property defines the different ways in which
  2506. an instance or instances of this type may be described textually.
  2507. This information may be used in narrative descriptions and by some
  2508. interfaces.
  2509. If @code{()}, then the instance will be described in some default
  2510. fashion, such as (for units) @code{"the <side> <ordinal> <type>"}.
  2511. Defaults to @code{()}.
  2512. @end deffn
  2513.  
  2514. @deffn TypeProperty @code{help} string
  2515. This property is a brief (preferably one-line) description of the type.
  2516. Defaults to @code{""}.
  2517. @end deffn
  2518.  
  2519. @deffn TypeProperty @code{notes} strings@dots{}
  2520. This property is detailed documentation about the type. 
  2521. The formatting of the strings is up to the interface,
  2522. but in general each string is a separate line,
  2523. the string @code{""} indicates a line break,
  2524. and two @code{""} in a row indicates a paragraph break.
  2525. Defaults to @code{()}.
  2526. @end deffn
  2527.  
  2528. @node Availability, Type Extension, Documentation, Types in General
  2529.  
  2530. @subsection Availability
  2531.  
  2532. It may be that a set of types is larger than strictly necessary for
  2533. a particular game.  You can make any type unavailable, which means
  2534. that irrespective of any other controls, that type cannot come into
  2535. play during a game.  You can also make it available only for particular
  2536. turns.
  2537.  
  2538. @deffn TypeProperty @code{available} n
  2539. If the value of this property is greater than 0, then this type is available
  2540. in the game on or after turn @var{n}.
  2541. If the value is less than 0, then the type is available,
  2542. but only until turn @var{-n}.
  2543. If the value is 0, then the type is never available.
  2544. Defaults to @code{1}, which means that the type is always available.
  2545. @end deffn
  2546.  
  2547. If a type becomes unavailable and there are units of that type in play,
  2548. then they will vanish immediately.
  2549.  
  2550. @node Type Extension, , Availability, Types in General
  2551.  
  2552. @subsection Type Extension
  2553.  
  2554. It may occasionally be necessary to add new kinds of
  2555. information to a type.
  2556. For instance, new synthesis methods may require special data,
  2557. or an interface may be able to use extra hints to improve its display.
  2558. The @code{extensions} property can be used to store this kind of data.
  2559.  
  2560. @deffn TypeProperty @code{extensions} properties@dots{}
  2561. This property is a catch-all for nonstandard type properties.
  2562. Anything may appear here, but it will only be interpreted as much as needed,
  2563. and unrecognized extensions will not be warned about (so if you misspell
  2564. one, you won't find out).
  2565. @end deffn
  2566.  
  2567. @node Unit Types, Terrain Types, Types in General, Reference Manual
  2568.  
  2569. @section Unit Types
  2570.  
  2571. @deffn Form @code{unit-type} symbol properties@dots{}
  2572. This form defines a new type of unit.
  2573. The @var{symbol} is required and must be previously undefined.
  2574. The bindings in @var{properties} are then added to the type one by one.
  2575. If no other name properties are defined, the @var{symbol} may be displayed
  2576. to players (see above).
  2577. You can define no more than 126 types of units.
  2578. @end deffn
  2579.  
  2580. The @var{symbol} here becomes the unit type's ``internal type name''
  2581. which is guaranteed unique.
  2582. To make synonyms for the internal type name, use @code{define}.
  2583.  
  2584. @deffn GlobalVariable @code{u*}
  2585. This variable evaluates to a list of all unit types,
  2586. listed in the order that they were defined.
  2587. This list always reflects the list of types at the moment it is evaluated.
  2588. @end deffn
  2589.  
  2590. @deffn GlobalVariable @code{non-unit}
  2591. This variable evaluates to a value that is NOT a unit type.
  2592. This is needed in several places to enable/disable features.
  2593. Use of this in any other way is an error,
  2594. and may or may not be detected before it causes a crash.
  2595. (Although described as a variable, its value cannot be changed.)
  2596. @end deffn
  2597.  
  2598. @menu
  2599. * Unit Naming::                 
  2600. * Class-Restricted Unit Types::  
  2601. * Self-Unit Capable Units::                  
  2602. * Limits on Unit Quantities::    
  2603. * Hit Points::                  
  2604. * Experience::                  
  2605. * Tech Levels vs Units::                 
  2606. * Opinions::                    
  2607. * Point Value::                 
  2608. @end menu
  2609.  
  2610. @node Unit Naming, Class-Restricted Unit Types, Unit Types, Unit Types
  2611.  
  2612. @subsection Unit Naming
  2613.  
  2614. @deffn UnitTypeProperty @code{namer} namer-id
  2615. This property is the namer that will be used to generate names for units,
  2616. if the unit's side does not have a namer, or the unit is
  2617. independent and not in any country.
  2618. Defaults to @code{0}, which leaves the unit unnamed.
  2619. @end deffn
  2620.  
  2621. @deffn UnitTypeProperty @code{assign-number} t/f
  2622. This property is true if the unit should have a serial number assigned to it
  2623. by the side it belongs to.
  2624. Serial numbers are maintained for each type on each side separately,
  2625. start at 1 for the first unit of the type, and increase by one each time.
  2626. Defaults to @code{true}.
  2627. @end deffn
  2628.  
  2629. @node Class-Restricted Unit Types, Self-Unit Capable Units, Unit Naming, Unit Types
  2630. @subsection Class-Restricted Unit Types
  2631.  
  2632. Sometimes the designer will want to make different sides have different types
  2633. of units.  Although this can be done by setting up scenarios appropriately,
  2634. that won't close all the loopholes that might allow a side to get units that
  2635. should only ever belong to another side.
  2636.  
  2637. The first step is to define a class for each side.  For instance,
  2638. a side named @code{"Rome"} might have a class @code{"Roman"},
  2639. while the sides named @code{"Aedui"} and @code{"Parisii"}
  2640. could both be in the class @code{"barbarian"}.
  2641.  
  2642. @deffn UnitTypeProperty @code{possible-sides} exp
  2643. This property restricts the unit type to only be usable
  2644. by a side meeting the conditions of @var{exp}.
  2645. If @var{exp} is a string, it restricts the unit type to only
  2646. be usable by a side whose class includes a matching string.
  2647. This may also be a boolean expression.
  2648. Independent units belong to a side whose class is @code{"independent"}.
  2649. The default of @code{""} allows the unit to belong to any side.
  2650. @end deffn
  2651.  
  2652. @node Self-Unit Capable Units, Limits on Unit Quantities, Class-Restricted Unit Types, Unit Types
  2653.  
  2654. @subsection Self-Unit Capable Units
  2655.  
  2656. The self-unit can be any type, including one that cannot act;
  2657. for instance, a capital city could be the self-unit, thus making
  2658. its defense all-important for a player.
  2659.  
  2660. @deffn GlobalVariable @code{self-required} t/f
  2661. This variable is true if each side is required to have a self-unit
  2662. at all times.
  2663. However, if no unit of a suitable type is available when the game begins,
  2664. then none will be required.
  2665. Defaults to @code{false}.
  2666. @end deffn
  2667.  
  2668. @deffn UnitTypeProperty @code{can-be-self} t/f
  2669. This property says that the type of unit can represent the side directly.
  2670. Defaults to @code{false}.
  2671. @end deffn
  2672.  
  2673. @deffn UnitTypeProperty @code{self-changeable} t/f
  2674. This property is true if the player can choose to change a self-unit of
  2675. this type at any time.
  2676. Otherwise the self-unit can be changed only if the current one dies.
  2677. Defaults to @code{false}.
  2678. @end deffn
  2679.  
  2680. @deffn UnitTypeProperty @code{self-resurrects} t/f
  2681. This property is true if when the self-unit dies, another unit of an allowable type
  2682. becomes the self-unit automatically.
  2683. Defaults to @code{false}.
  2684. @end deffn
  2685.  
  2686. Observe that these parameters can be used to develop various forms of
  2687. backup, so that a player can start out as a capital city, resurrect as
  2688. a town, change self to one of several towns, then lose when all the towns
  2689. are lost.
  2690.  
  2691. @deffn UnitTypeProperty @code{direct-control} t/f
  2692. This property is true if a unit of this type can be controlled by its side
  2693. automatically.
  2694. If false, then it must be within range of a unit that can control it,
  2695. and is itself under control by the side.
  2696. Defaults to @code{true}.
  2697. @end deffn
  2698.  
  2699. @deffn Table @code{control-chance-at} u1 u2 -> n%
  2700. @end deffn
  2701.  
  2702. @deffn Table @code{control-chance-adjacent} u1 u2 -> n%
  2703. @end deffn
  2704.  
  2705. @deffn Table @code{control-chance} u1 u2 -> n%
  2706. @end deffn
  2707.  
  2708. @deffn Table @code{control-range} u1 u2 -> dist
  2709. This table gives the maximum distance from self-unit @var{u1}
  2710. at which units of type @var{u2} can be controlled directly.
  2711. Units further away always act on their own.
  2712. If this value is < 0, then @var{u1} can never directly control
  2713. any other @var{u2} on the side.
  2714. Defaults to @code{infinity}.
  2715. @end deffn
  2716.  
  2717. @node Limits on Unit Quantities, Hit Points, Self-Unit Capable Units, Unit Types
  2718.  
  2719. @subsection Limits on Unit Quantities
  2720.  
  2721. The effect of these is
  2722. to prevent any extra units from being created or from going over to a
  2723. side, regardless of the reason.
  2724. This happens by either preventing player actions that would
  2725. result in exceeding a limit (such as when building units), or by making
  2726. the unit vanish instantly (such as when capturing a unit).
  2727.  
  2728. @deffn GlobalVariable @code{units-in-game-max} n
  2729. This variable is the maximum number of all types of units, on all sides,
  2730. including independents, that may exist at any time, including initially.
  2731. Defaults to @code{-1}, which means that there is no limit.
  2732. @end deffn
  2733.  
  2734. @deffn GlobalVariable @code{units-per-side-max} n
  2735. This variable is the maximum number of units (of all types together) 
  2736. that any side may have, at any time.  Events that would cause
  2737. the limit to be exceeded, such as capturing a unit, result in
  2738. either the unit vanishing or becoming independent.
  2739. Defaults to @code{-1}, which means that there is no limit.
  2740. @end deffn
  2741.  
  2742. There is no limit on the number of units that may be independent.
  2743.  
  2744. @deffn UnitTypeProperty @code{type-in-game-max} n
  2745. This property is the maximum total of the given type, for all sides together.
  2746. Defaults to @code{-1}, which means that there is no limit.
  2747. @end deffn
  2748.  
  2749. @deffn UnitTypeProperty @code{type-per-side-max} n
  2750. This property is the maximum number of units of the given type allowed to each side.
  2751. Defaults to @code{-1}, which means that there is no limit.
  2752. @end deffn
  2753.   
  2754. @node Hit Points, Experience, Limits on Unit Quantities, Unit Types
  2755.  
  2756. @subsection Hit Points
  2757.  
  2758. A unit's hit points determine how healthy it is.
  2759. If a unit's hp goes below 1, it is either @dfn{wrecked},
  2760. meaning that it changes to a new type
  2761. @code{wrecked-type} or else it @dfn{vanishes},
  2762. meaning that it is completely cleared from the world.
  2763.  
  2764. @deffn UnitTypeProperty @code{hp-max} n
  2765. This property is the maximum number of hit points for (each part of) a unit.
  2766. Completed units start with this many hit points.
  2767. Defaults to @code{1}.
  2768. @end deffn
  2769.  
  2770. @deffn UnitTypeProperty @code{parts-max} n
  2771. This property declares that a unit is really
  2772. an aggregate of @var{n} smaller identical units.
  2773. Defaults to @code{1}.
  2774. @end deffn
  2775.  
  2776. @deffn UnitTypeProperty @code{wrecked-type} unit-type
  2777. This property is the type of unit that a unit with 0 hp will become.
  2778. For instance, a destroyed ``fort'' might become a ``rubble pile'' unit.
  2779. If its value is @code{non-unit}, then the destroyed unit just vanishes.
  2780. The @code{wrecked-type} of a type must be a different type.
  2781. Defaults to @code{non-unit}.
  2782. @end deffn
  2783.  
  2784. The transformation to the wrecked type does not change position or name.
  2785. The transformed unit has full hp, supplies are conserved as much as possible,
  2786. tooling is preserved, and any unit plan is erased.
  2787. It has the same number of parts, or as many as possible if that is fewer.
  2788. It may be that the
  2789. wrecked type is on terrain that it cannot survive on; in that case, it
  2790. will be wrecked again, repeating until the unit either vanishes
  2791. or is in a viable position, or this process has been repeated
  2792. more times than the number of unit types (prevents infinite loops).
  2793. Any excess occupants will be removed and either placed in another nearby
  2794. unit or in the open, or will vanish if there is no other option.
  2795.  
  2796. @deffn UnitTypeProperty @code{hp-recovery} n
  2797. This property is the number of 1/100 hp recovered per turn.
  2798. Recovery happens automatically at the end of each turn.
  2799. The amount @i{n} / 100 is recovered automatically each turn,
  2800. while @i{n} mod 100 is the percent chance of recovering 
  2801. an additional 1 hit point.
  2802. Defaults to @code{0}.
  2803. @end deffn
  2804.  
  2805. @node Experience, Tech Levels vs Units, Hit Points, Unit Types
  2806.  
  2807. @subsection Experience
  2808.  
  2809. @deffn UnitTypeProperty @code{cxp-max} cxp
  2810. This property is the maximum combat experience this type of unit can have.
  2811. Defaults to @code{0}.
  2812. @end deffn
  2813.  
  2814. @node Tech Levels vs Units, Opinions, Experience, Unit Types
  2815.  
  2816. @subsection Tech Levels vs Units
  2817.  
  2818. Before it can do anything with a type of unit,
  2819. the side must have the appropriate tech level for that type,
  2820. which is just a number ranging from 0 up to @code{tech-level-max}.
  2821. Each type has a distinct tech level.
  2822.  
  2823. Tech levels always increase
  2824. (since they represent abstract knowledge rather than physical plant).
  2825. Tech can be transferred freely to any other side
  2826. via the message @code{tech} [xref to messages].
  2827.  
  2828. For each unit type, the following parameters define the minimum tech levels at
  2829. which sides can do various things.
  2830.  
  2831. @deffn UnitTypeProperty @code{tech-to-see} tl
  2832. This property is the minimum tech level that a side must have before it can see
  2833. a unit of this type.
  2834. Defaults to @code{0}.
  2835. @end deffn
  2836.  
  2837. @deffn UnitTypeProperty @code{tech-to-own} tl
  2838. This property is the minimum tech level
  2839. that a side must have in order to have a unit of this type.
  2840. Defaults to @code{0}.
  2841. @end deffn
  2842.  
  2843. @deffn UnitTypeProperty @code{tech-from-ownership} tl
  2844. This property is the tech level that may be reached
  2845. by acquiring a unit of this type.
  2846. Since this is expressed as a minimum,
  2847. multiple acquisitions have no additional effect.
  2848. Defaults to @code{0}.
  2849. @end deffn
  2850.  
  2851. @deffn UnitTypeProperty @code{tech-to-use} tl
  2852. This property is the minimum tech level that a side must have in order to
  2853. give actions to this type of unit.
  2854. Defaults to @code{0}.
  2855. @end deffn
  2856.  
  2857. @deffn UnitTypeProperty @code{tech-to-build} tl
  2858. This property is the minimum tech level that a side
  2859. must have in order to build this type of unit.
  2860. Defaults to @code{0}.
  2861. @end deffn
  2862.  
  2863. @deffn UnitTypeProperty @code{tech-max} tl
  2864. This property is the absolute maximum tech level possible for this type.
  2865. Defaults to @code{0}.
  2866. @end deffn
  2867.  
  2868. @deffn Table @code{tech-crossover} u1 u2 -> n%
  2869. This table is the minimum tech level for @var{u2} that is guaranteed by a particular
  2870. tech level for @var{u1}, expressed as a percentage of the @code{tech-max}
  2871. for the types.
  2872. For instance, if @code{tech-crossover} is 80, and the tech level for @var{u1}
  2873. is 10 out of a max of 20, and the max for @var{u2} is also 20,
  2874. then the side has a tech for @var{u2} at least 8.
  2875. Defaults to @code{0}.
  2876. @end deffn
  2877.  
  2878. It is possible to gain some tech level just by being in the same game
  2879. with a side that is more advanced.
  2880.  
  2881. @deffn UnitTypeProperty @code{tech-leakage} .01tl
  2882. This property is the amount of tech level gain per turn that can happen
  2883. to any side's tech level that is less than the max of all sides in the game.
  2884. This only happens if at least one unit on the side has nonzero coverage
  2885. of a unit on a more advanced side.
  2886. Defaults to @code{0}.
  2887. @end deffn
  2888.  
  2889. @node Opinions, Point Value, Tech Levels vs Units, Unit Types
  2890.  
  2891. @subsection Opinions
  2892.  
  2893. @deffn UnitTypeProperty @code{has-opinions} t/f
  2894. This property is true if the unit has opinions about sides,
  2895. both other sides and its own.
  2896. Defaults to @code{false}.
  2897. @end deffn
  2898.  
  2899. @node Point Value, , Opinions, Unit Types
  2900.  
  2901. @subsection Point Value
  2902.  
  2903. Point values provide an abstract way to characterize the overall importance
  2904. of a unit type.
  2905. Point values figure into some scorekeepers, and are used by AIs.
  2906.  
  2907. @deffn UnitTypeProperty @code{point-value} n
  2908. This property is the ``value'' of a unit.
  2909. Defaults to @code{1}.
  2910. @end deffn
  2911.  
  2912. @node Terrain Types, Material Types, Unit Types, Reference Manual
  2913.  
  2914. @section Terrain Types
  2915.  
  2916. Terrain types are associated with the cells, borders,
  2917. connections, and coatings in a world.
  2918.  
  2919. @deffn Form @code{terrain-type} name properties@dots{}
  2920. This form defines a new type of terrain, named by @var{name}.
  2921. Details are similar to those for unit types.
  2922. @end deffn
  2923.  
  2924. @deffn GlobalVariable @code{t*}
  2925. This variable evaluates to a list of all terrain types,
  2926. listed in the order that they were defined.
  2927. @end deffn
  2928.  
  2929. @deffn GlobalVariable @code{non-terrain}
  2930. This variable has a value that is guaranteed not to be a terrain type.
  2931. @end deffn
  2932.  
  2933. @menu
  2934. * Terrain Subtypes::            
  2935. * Terrain Compatibility::       
  2936. * Other Terrain Properties::    
  2937. * People::                      
  2938. @end menu
  2939.  
  2940. @node Terrain Subtypes, Terrain Compatibility, Terrain Types, Terrain Types
  2941.  
  2942. @subsection Terrain Subtypes
  2943.  
  2944. Terrain can appear in four different roles: as the interior of
  2945. a cell, as a border between cells, as a connection between cells,
  2946. or as a coating overlaying the normal terrain.
  2947. The terrain subtype says which role a type can play.
  2948.  
  2949. @deffn TerrainTypeProperty @code{subtype} subtype
  2950. This property is the role that the terrain type can appear in.
  2951. Defaults to @code{cell}.
  2952. @end deffn
  2953.  
  2954. @deffn GlobalConstant @code{cell}
  2955. This constant indicates that terrain can fill a cell.
  2956. All units in the open and with an altitude of 0 are assumed
  2957. to be surrounded by the cell terrain.
  2958. @end deffn
  2959.  
  2960. @deffn GlobalConstant @code{border}
  2961. This constant indicates that the terrain can be a border.
  2962. @end deffn
  2963.  
  2964. @deffn GlobalConstant @code{connection}
  2965. This constant indicates that the terrain can be a connection.
  2966. @end deffn
  2967.  
  2968. @deffn GlobalConstant @code{coating}
  2969. This constant indicates that the terrain can be a coating.
  2970. A @dfn{coating} is a temporary terrain modification.
  2971. The classic example is snow,
  2972. which effectively changes some kinds of terrain,
  2973. but not completely and usually not permanently.
  2974. Cells can have varying heaviness of each type of coating.
  2975. @end deffn
  2976.  
  2977. @deffn Table @code{coating-depth-min} t1 t2 -> n
  2978. In order for a coating @var{t1} to ``stick'',
  2979. this table says much must be added all at once to terrain @var{t2}.
  2980. A coating depth that drops below this will disappear immediately.
  2981. Defaults to @code{0}.
  2982. @end deffn
  2983.  
  2984. @deffn Table @code{coating-depth-max} t1 t2 -> n
  2985. This table is the upper limit on coating depth.
  2986. Defaults to @code{0}.
  2987. @end deffn
  2988.  
  2989. Terrain types may have additional subtype attributes that
  2990. are used only during synthesis, to select appropriate subtypes
  2991. for special purposes.
  2992.  
  2993. @deffn TerrainTypeProperty @code{subtype-x} n
  2994. This property is extra subtype information, used in synthesis.
  2995. Defaults to @code{no-x}.
  2996. @end deffn
  2997.  
  2998. @deffn GlobalConstant @code{no-x}
  2999. @end deffn
  3000.  
  3001. @deffn GlobalConstant @code{river-x}
  3002. This constant indicates that synthesis methods should treat this
  3003. type as a river.
  3004. The terrain type may be either a border or a connection.
  3005. @end deffn
  3006.  
  3007. @deffn GlobalConstant @code{valley-x}
  3008. This constant indicates that synthesis methods should treat this type
  3009. as a valley.
  3010. @end deffn
  3011.  
  3012. @deffn GlobalConstant @code{road-x}
  3013. This constant indicates that synthesis methods should treat this type
  3014. as a road.
  3015. @end deffn
  3016.  
  3017. @deffn TerrainTypeProperty @code{liquid} t/f
  3018. This property is true if the terrain type represents a liquid,
  3019. which means that adjacent cells of liquid must have the same elevation.
  3020. Defaults to @code{false}.
  3021. @end deffn
  3022.  
  3023. @node Terrain Compatibility, Other Terrain Properties, Terrain Subtypes, Terrain Types
  3024.  
  3025. @subsection Terrain Compatibility
  3026.  
  3027. Terrain types are not always mutually compatible.
  3028. Incompatible types may not be juxtaposed, either at
  3029. game setup time or by unit action during a game.
  3030.  
  3031. @deffn Table @code{adjacent-terrain-effect} t1 t2 -> t3
  3032. This table specifies what will happen to a cell of type @var{t1}
  3033. adjacent to a cell of type @var{t2}.  If @var{t3} is @code{non-terrain},
  3034. nothing will happen, otherwise it will become a cell of type @var{t3}.
  3035.  
  3036. If @var{t1} is a border type adjacent to a cell of type @var{t2},
  3037. and if @var{t3} is @code{non-terrain}, nothing will happen.
  3038. Otherwise, the border of type @var{t1} will be removed,
  3039. and if @var{t3} is a border type, a border of that type will be added.
  3040. The effect on connection types is analogous.
  3041.  
  3042. Defaults to @code{non-terrain}.
  3043. @end deffn
  3044.  
  3045. @node Other Terrain Properties, , Terrain Compatibility, Terrain Types
  3046.  
  3047. @subsection Other Terrain Properties
  3048.  
  3049. @deffn TerrainTypeProperty @code{elevation-min} dist
  3050. @end deffn
  3051. @deffn TerrainTypeProperty @code{elevation-max} dist
  3052. These properties define the minimum and maximum possible values
  3053. for the elevation in a cell of given terrain type.
  3054. Both default to @code{0}.
  3055. @end deffn
  3056.  
  3057. @deffn TerrainTypeProperty @code{temperature-min} n
  3058. @end deffn
  3059. @deffn TerrainTypeProperty @code{temperature-max} n
  3060. These properties define the minimum and maximum possible values
  3061. for the temperature in a cell of given terrain type.
  3062. Both default to @code{0}.
  3063. @end deffn
  3064.  
  3065. @deffn TerrainTypeProperty @code{wind-force-min} n
  3066. @end deffn
  3067. @deffn TerrainTypeProperty @code{wind-force-max} n
  3068. These properties define limits on wind force.
  3069. Both default to @code{0}.
  3070. @end deffn
  3071.  
  3072. @deffn TerrainTypeProperty @code{clouds-min} n
  3073. @end deffn
  3074. @deffn TerrainTypeProperty @code{clouds-max} n
  3075. These properties define limits on cloud density.
  3076. Both default to @code{0}.
  3077. @end deffn
  3078.  
  3079. @node Material Types, Static Relationships Between Types, Terrain Types, Reference Manual
  3080.  
  3081. @section Material Types
  3082.  
  3083. Materials are materials that are manipulated in mass quantities.
  3084. In general, material types just index vectors of values attached
  3085. to other objects, such as unit supplies.
  3086.  
  3087. No more than 126 types of material may be defined.
  3088.  
  3089. @deffn Form @code{material-type} symbol properties@dots{}
  3090. This form defines a new type of material, named by @var{symbol}.
  3091. Details are similar to those for unit types.
  3092. @end deffn
  3093.  
  3094. @deffn GlobalVariable @code{m*}
  3095. This variable evaluates to a list of all material types,
  3096. listed in the same order as they were defined.
  3097. @end deffn
  3098.  
  3099. @deffn GlobalVariable @code{non-material}
  3100. This variable has a value that is never a material type.
  3101. @end deffn
  3102.  
  3103. @menu
  3104. * People::
  3105. @end menu
  3106.  
  3107. @node People, , , Material Types
  3108.  
  3109. @subsection People
  3110.  
  3111. A material type can be designated as representing people.
  3112.  
  3113. @deffn MaterialTypeProperty @code{people} n
  3114. This property is the actual number of individuals
  3115. represented by 1 of a material.
  3116. If 0, then the material type does not have people associated with it at all.
  3117. Defaults to @code{0}.
  3118. @end deffn
  3119.  
  3120. Multiple types of materials can represent different types of people,
  3121. so for example there could be one type @code{nomad} with 10 people/material,
  3122. and another type @code{urbanite} with 10,000 people/material.
  3123.  
  3124. The basic cell capacities for materials also constrain people
  3125. materials. There can be an additional limit on the number of individuals.
  3126.  
  3127. @deffn TerrainTypeProperty @code{people-max} n
  3128. This property is the maximum number of individuals allowed
  3129. in a cell of this type of terrain.
  3130. This is checked at the end of each turn;
  3131. any excess will be moved into adjacent cells or disappear entirely.
  3132. Defaults to @code{-1}, which allows any number of people in a cell.
  3133. @end deffn
  3134.  
  3135. @node Static Relationships Between Types, Vision, Material Types, Reference Manual
  3136.  
  3137. @section Static Relationships Between Types
  3138.  
  3139. In general, static relationships are those that must always hold
  3140. during a turn.  @i{Xconq} will usually only test these when
  3141. necessary, but this is up to the implementation.
  3142. From the players' and designers' point of view, these relationships
  3143. can never be violated, even temporarily.
  3144.  
  3145. @menu
  3146. * Occupants and Transports::    
  3147. * Units and Terrain::           
  3148. * Units and Materials::         
  3149. * Terrain and Materials::       
  3150. @end menu
  3151.  
  3152. @node Occupants and Transports, Units and Terrain, , Static Relationships Between Types
  3153.  
  3154. @subsection Occupants and Transports
  3155.  
  3156. A unit inside another unit is an ``occupant'' in a ``transport'',
  3157. even if the ``transport'' can never move.
  3158. There are two kinds of capacity.  Generic capacity is shared by
  3159. all different types, while guaranteed capacity is for a particular
  3160. type only.
  3161.  
  3162. @deffn UnitTypeProperty @code{capacity} n
  3163. This property is the limit on the sum of sizes of units that may occupy this
  3164. type of unit, not counting the exclusive capacities.
  3165. Defaults to @code{0}.
  3166. @end deffn
  3167.  
  3168. @deffn Table @code{unit-size-as-occupant} u1 u2 -> n
  3169. This table is the ``size'' of a (full-sized) unit @var{u1} when it is in
  3170. a transport @var{u2}.
  3171. Defaults to @code{1}.
  3172. @end deffn
  3173.  
  3174. @deffn Table @code{unit-capacity-x} u1 u2 -> n
  3175. This table is the number of units of type @var{u2} that are guaranteed
  3176. a place in a unit of type @var{u1}.
  3177. Defaults to @code{0}.
  3178. @end deffn
  3179.  
  3180. @deffn Table @code{occupant-max} u1 u2 -> n
  3181. This table is the upper limit on the number of occupants of this type
  3182. (not counting @code{unit-capacity-x}).
  3183. Defaults to @code{0}.
  3184. @end deffn
  3185.  
  3186. @deffn UnitTypeProperty @code{occupant-total-max} n
  3187. This property is the upper limit on occupants of all types together.
  3188. Defaults to @code{-1}, which allows unlimited occupancy.
  3189. @end deffn
  3190.  
  3191. A unit that is an occupant may not always have the same capabilities
  3192. as when it is out in the open.  Its vision, combat, construction, and
  3193. capacity may be affected.
  3194.  
  3195. @deffn Table @code{occupant-vision} u1 u2 -> t/f
  3196. Defaults to @code{true}.
  3197. @end deffn
  3198.  
  3199. @deffn Table @code{occupant-combat} u1 u2 -> n%
  3200. This table defines the effect on the combat abilities
  3201. of a unit of type @var{u1} when an occupant in a unit of type @var{u2}.
  3202. If @code{0}, then the occupant cannot attack or fire.
  3203. Defaults to @code{100}.
  3204. @end deffn
  3205.  
  3206. @deffn Table @code{occupant-can-construct} u1 u2 -> t/f
  3207. This table is @code{true} if @var{u1} can 
  3208. create or complete units while an occupant of @var{u2}.
  3209. Defaults to @code{false}.
  3210. @end deffn
  3211.  
  3212. @deffn Table @code{occupant-can-have-occupants} u1 u2 -> t/f
  3213. This table is @code{true} if @var{u1} can have occupants of its own
  3214. while an occupant of @var{u2}.
  3215. Defaults to @code{false}.
  3216. @end deffn
  3217.  
  3218. @node Units and Terrain, Units and Materials, Occupants and Transports, Static Relationships Between Types
  3219.  
  3220. @subsection Units and Terrain
  3221.  
  3222. This section describes relationships between units and terrain.
  3223. Units can be set to disappear or be wrecked on particular types of
  3224. terrain.  If the terrain can be occupied safely, there may be a limit
  3225. on the numbers of units that can be in the same cell.
  3226.  
  3227. @deffn Table @code{vanishes-on} u t -> t/f
  3228. This table is @code{true} if a unit @var{u} will disappear instantly if it
  3229. somehow ends up on terrain of type @var{t}.
  3230. Defaults to @code{false}.
  3231. @end deffn
  3232.  
  3233. @deffn Table @code{wrecks-on} u t -> t/f
  3234. This table is @code{true} if a unit @var{u} will wreck instantly if it
  3235. somehow ends up on terrain of type @var{t}.
  3236. Defaults to @code{false}.
  3237. @end deffn
  3238.  
  3239. @deffn TerrainTypeProperty @code{capacity} n
  3240. This property is the limit on the sum of unit sizes that may share this cell.
  3241. Defaults to @code{1}.
  3242. @end deffn
  3243.  
  3244. @deffn Table @code{unit-size-in-terrain} u t -> n
  3245. This table is the ``size'' of a (full-sized) unit @var{u} when it is
  3246. in/on the terrain @var{t}.
  3247. Defaults to @code{1}.
  3248. @end deffn
  3249.  
  3250. @deffn Table @code{terrain-capacity-x} u t -> n
  3251. This table is the number of (full-sized) units of type @var{u}
  3252. that are guaranteed to have a place in the cell.
  3253. Defaults to @code{0}.
  3254. @end deffn
  3255.  
  3256. Note that the units' sides are irrelevant;
  3257. the sizes of units of all sides are added together.
  3258. Limits are calculated separately for the connection and open terrain
  3259. in a cell.
  3260.  
  3261. @deffn UnitTypeProperty @code{stack-order} n
  3262. This property is the relative position of this type of unit within a stack of
  3263. different units.
  3264. Larger values put units higher in the stack.
  3265. The exact values are unimportant, they are just used as sort keys.
  3266. The use of this value is to ensure that particular types are ``seen first''
  3267. when looking at a cell, so for instance if a truck and a city are stacked
  3268. on the same cell, everybody will see the city and not the truck.
  3269. The owner of these units can still see them.
  3270. If the stack-order of two units is the same,
  3271. then the higher-numbered type will be higher in the stack.
  3272. Defaults to @code{0}.
  3273. @end deffn
  3274.  
  3275. There is a possible bizarrity with stacking limits and units that can't
  3276. see each other when in the same hex, namely that a player could be prevented
  3277. from moving a unit into a cell that looks like it has enough room.
  3278.  
  3279. @node Units and Materials, Terrain and Materials, Units and Terrain, Static Relationships Between Types
  3280.  
  3281. @subsection Units and Materials
  3282.  
  3283. Units can carry materials.
  3284.  
  3285. @deffn Table @code{unit-storage-x} u m -> n
  3286. This table is the space reserved specifically for each
  3287. type of material.
  3288. Defaults to @code{0}.
  3289. @end deffn
  3290.  
  3291. Materials that represent people may surrender to a unit in their cell.
  3292.  
  3293. @deffn Table @code{people-surrender-chance} u t -> n%
  3294. This table is the base chance that people in terrain of type @var{t}
  3295. will change sides if a unit of type @var{u} is in their cell.
  3296. Defaults to @code{0}.
  3297. @end deffn
  3298.  
  3299. @deffn Table @code{people-surrender-effect} u m -> n
  3300. This is a multiplier that takes the people type into account.
  3301. Defaults to @code{100}.
  3302. @end deffn
  3303.  
  3304. @node Terrain and Materials,  , Units and Materials, Static Relationships Between Types
  3305.  
  3306. @subsection Terrain and Materials
  3307.  
  3308. @deffn Table @code{terrain-storage-x} t m -> n
  3309. This table is the maximum amount of a material @var{m}
  3310. that may be present in a cell with terrain @var{t}.
  3311. Defaults to @code{0}.
  3312. @end deffn
  3313.  
  3314. @node Vision, Game Initialization, Static Relationships Between Types, Reference Manual
  3315.  
  3316. The parameters in this section define how sides get information about the
  3317. world, units, and other sides.
  3318.  
  3319. @section Vision
  3320.  
  3321. @menu
  3322. * Basic Vision::
  3323. * Weather Vision::              
  3324. * Line of Sight::               
  3325. * Spying::                      
  3326. @end menu
  3327.  
  3328. @node Basic Vision, Weather Vision, Vision, Vision
  3329.  
  3330. @subsection Basic Vision
  3331.  
  3332. @deffn GlobalVariable @code{see-all} t/f
  3333. This variable is @code{true} if everything in the world, units, terrain, etc,
  3334. is always visible at all times, including initially.
  3335. It takes precedence over @i{all} other visibility and spying parameters.
  3336. Defaults to @code{false}.
  3337. @end deffn
  3338.  
  3339. @deffn GlobalVariable @code{see-terrain-always} t/f
  3340. If this variable is @code{true}, then any side that has seen the terrain of a cell
  3341. will be informed if that terrain ever changes.
  3342. Defaults to @code{true}.
  3343. @end deffn
  3344.  
  3345. @deffn UnitTypeProperty @code{see-always} t/f
  3346. This property is @code{true} when a unit is always visible
  3347. after it has been seen once,
  3348. so that side changes, movements, etc will be seen forever afterwards.
  3349. If the unit moves into terrain that has not been seen,
  3350. then that terrain also becomes seen as well.
  3351. Defaults to @code{false}.
  3352. @end deffn
  3353.  
  3354. @deffn UnitTypeProperty @code{see-occupants} t/f
  3355. This property is @code{true} when a unit's occupants are also seen
  3356. whenever the unit itself is under observation.
  3357. Defaults to @code{false}.
  3358. @end deffn
  3359.  
  3360. @deffn UnitTypeProperty @code{spot-action} t/f
  3361. If this property is @code{true},
  3362. then the unit's chance to be seen by other sides will be
  3363. tested each time the unit acts in any way.
  3364. This property is in addition to the check at the beginning of each turn.
  3365. Defaults to @code{true}.
  3366. @end deffn
  3367.  
  3368. The people in a cell effectively view (for their side)
  3369. all units in that cell.
  3370. Some units can hide from the people.
  3371.  
  3372. @deffn Table @code{people-see-chance} u m -> n%
  3373. This table is the chance that the people of the
  3374. given type @var{m} will see a unit of type @var{u}.
  3375. This will be evaluated for each people type individually,
  3376. once at the beginning of each turn, and once for each populated cell
  3377. that the unit enters during the turn.
  3378. Defaults to @code{100}.
  3379. @end deffn
  3380.  
  3381. @deffn UnitTypeProperty @code{vision-range} dist
  3382. This property is the maximum range of vision coverage by the unit.
  3383. A value of @code{-1} disables all vision,
  3384. @code{0} means only units in the same cell may be seen,
  3385. and @code{1} means units in adjacent cells may be seen.
  3386. Defaults to @code{1}.
  3387. @end deffn
  3388.  
  3389. @deffn Table @code{see-chance-at} u1 u2 -> n%
  3390. This table is the chance that a unit @var{u1} will see
  3391. another sides's unit of type @var{u2} when both are
  3392. in the same cell.
  3393. Defaults to @code{100}.
  3394. @end deffn
  3395.  
  3396. @deffn Table @code{see-chance-adjacent} u1 u2 -> n%
  3397. This table is the chance that a unit @var{u1} will see
  3398. another sides's unit of type @var{u2} when the two
  3399. are in adjacent cells.
  3400. Defaults to @code{100}.
  3401. @end deffn
  3402.  
  3403. @deffn Table @code{see-chance} u1 u2 -> n%
  3404. This table is the base chance that a unit @var{u1}
  3405. will see a unit @var{u2} in cells at distance 2 or greater.
  3406. Defaults to @code{100}.
  3407. @end deffn
  3408.  
  3409. @deffn Table @code{visibility} u t -> n
  3410. This table is the effect of terrain @var{t}
  3411. on a unit @var{u}'s chances of being seen.
  3412. Values less than 100 are reduced visibility,
  3413. values greater than 100 increase the unit's
  3414. chances to be seen.
  3415. Defaults to @code{100}.
  3416. @end deffn
  3417.  
  3418. @deffn Table @code{vision-night-effect} u t -> n
  3419. This table is the multiplier for unit @var{u}'s vision at night
  3420. in each type of terrain @var{t}.
  3421. Effect is to multiply with both vision range and see-chance.
  3422. Defaults to @code{100}.
  3423. @end deffn
  3424.  
  3425. @node Weather Vision, Line of Sight, Basic Vision, Vision
  3426.  
  3427. @subsection Weather Vision
  3428.  
  3429. @deffn GlobalVariable @code{see-weather-always} t/f
  3430. If true, then weather changes (in cells that have been seen) will always be reported.
  3431. Defaults to @code{true}.
  3432. @end deffn
  3433.  
  3434. @node Line of Sight, Spying, Weather Vision, Vision
  3435.  
  3436. @subsection Line of Sight
  3437.  
  3438. @deffn UnitTypeProperty @code{vision-bend} n
  3439. This property is the amount by which a unit can see ``around corners''.
  3440. 0 means that vision is strictly line-of-sight,
  3441. while 100 means that elevations never obstruct vision.
  3442. Defaults to @code{100}.
  3443. @end deffn
  3444.  
  3445. @deffn Table @code{eye-height} u t -> dist
  3446. This propety is the additional elevation above the unit's position that a unit
  3447. can see with, when in the given terrain.
  3448. Defaults to @code{0}.
  3449. @end deffn
  3450.  
  3451. @deffn TerrainTypeProperty @code{thickness} dist
  3452. This property is the thickness of the terrain, which is the difference between
  3453. the ``ground'' of the terrain and its top.
  3454. Defaults to @code{0}.
  3455. @end deffn
  3456.  
  3457. @node Spying, , Line of Sight, Vision
  3458.  
  3459. @subsection Spying
  3460.  
  3461. A unit type can also be specified to do spying automatically.
  3462. The outcome of spying is calculated once/unit/turn,
  3463. at the beginning of the turn (after move calculation but before
  3464. any players can do anything).
  3465. Spying can happen to any unit not on the spying unit's side.
  3466.  
  3467. @deffn UnitTypeProperty @code{spy-chance} .01n%
  3468. This property is the chance that the unit will be successful at spying.
  3469. Defaults to @code{0}.
  3470. @end deffn
  3471.  
  3472. @deffn UnitTypeProperty @code{spy-range} dist
  3473. This property is the maximum distance at which the unit will find out
  3474. something by spying.
  3475. Defaults to @code{0}.
  3476. @end deffn
  3477.  
  3478. @deffn Table @code{spy-quality} u1 u2 -> n%
  3479. This table gives the chance that @var{u1}'s spying will return information
  3480. about a unit of type @var{u2} that is within the spying range.
  3481. Defaults to @code{100}.
  3482. @end deffn
  3483.  
  3484. @node Game Initialization, Synthesis Methods, Vision, Reference Manual
  3485.  
  3486. @section Game Initialization
  3487.  
  3488. Game initialization always starts by resetting all the game-defining data
  3489. structures to an empty state.  This means no types, no world, etc.
  3490. Then @i{Xconq} reads and interprets
  3491. all of the game modules that have been requested.
  3492. These modules may overwrite each other arbitrarily.
  3493. Then any command line or startup options
  3494. are processed (this may involve an interactive dialog),
  3495. and the random number generator is initialized.
  3496. and players are matched with sides
  3497. (any sides needed for players will be created and named at this time).
  3498. @i{Xconq} then executes a number of @i{synthesis methods}
  3499. to do various kinds of setup.
  3500.  
  3501. (Some interfaces might allow for confirmation of the setup before
  3502. launching into the game proper, but this cannot be assumed.)
  3503.  
  3504. Since the details of good game synthesis can be complicated,
  3505. synthesis methods are simply wired-in pieces of code.
  3506. Each method is self-contained; it assumes the game state to be valid,
  3507. it will determine its own applicability and
  3508. produce a valid result.  It will also acquire any data that it
  3509. needs, so does not require any special setup;  however, a method
  3510. may fail to run if it cannot find that data.
  3511. For instance, the usual fractal
  3512. terrain generator needs percentiles for each terrain type, and
  3513. will not function without them.  It may be that all the requested
  3514. synthesis methods fail; this is OK if @i{Xconq}'s data is present
  3515. and consistent, but otherwise @i{Xconq} will shut itself down, since
  3516. it has no remaining alternatives (think of this as a serious
  3517. programming error and fix the game design).
  3518.  
  3519. @node Synthesis Methods, Setup Postprocessing, Game Initialization, Reference Manual
  3520.  
  3521. @section Synthesis Methods
  3522.  
  3523. The synthesis method list specifies which methods will be run,
  3524. and in what order.
  3525. After they have all been run, @i{Xconq} runs a consistency and completeness
  3526. check.  For instance, there should be a world with terrain everywhere.
  3527. Failure at this point is fatal; @i{Xconq} will either exit
  3528. or return to a game setup dialog.
  3529.  
  3530. @menu
  3531. * Synthesis Method List::
  3532. * Fractal World::               
  3533. * Maze World::                  
  3534. * Random World::                
  3535. * Earthlike World::             
  3536. * Making Rivers::            
  3537. * Making Roads::             
  3538. * Making Countries::            
  3539. * Making Independent Units::    
  3540. * Making Weather::              
  3541. * Making Initial Supply::              
  3542. * Naming Geographical Features::  
  3543. * Naming Units::                
  3544. * Making a Random Date::        
  3545. @end menu
  3546.  
  3547. @node Synthesis Method List, Fractal World, Synthesis Methods, Synthesis Methods
  3548.  
  3549. @subsection Synthesis Method List
  3550.  
  3551. @deffn GlobalVariable @code{synthesis-methods} method-list
  3552. This variable is a list of synthesis methods.
  3553. If the list is empty, no synthesis methods will be run.
  3554. @end deffn
  3555.  
  3556. The list of synthesis methods is ordered, and many contain duplicates,
  3557. so that a method can be run multiple times during setup.
  3558. Note that most of the existing methods will simply return if they
  3559. detect that their work has already been done, so multiple runs will
  3560. have no effect.
  3561.  
  3562. The default synthesis method list is effectively
  3563. @example
  3564. (make-fractal-percentile-terrain
  3565.  make-countries
  3566.  make-independent-units
  3567.  make-roads
  3568.  make-rivers
  3569.  make-weather
  3570.  init-supplies
  3571.  name-geographical-features
  3572. )
  3573. @end example
  3574.  
  3575. The synthesis method list may also contain items of the form
  3576.  
  3577. @example
  3578. ("program" forms...)
  3579. @end example
  3580.  
  3581. For each of these items, @i{Xconq} will attempt to find and run
  3582. an external program named @code{"program"},
  3583. giving it as input the result of evaluating the @code{forms},
  3584. and then reading the output of the program, which must be a valid
  3585. game module.
  3586. The program must be capable of interpreting two arguments;
  3587. the first is the name of the input file it is to read from,
  3588. and the second is the name of the output file it must write to.
  3589. If successful, it should return with a result code of 0;
  3590. otherwise, @i{Xconq} will issue a warning to players.
  3591.  
  3592. Any further details will depend on your system,
  3593. since each will use different conventions.
  3594. Note that this is NOT a portable construct; you cannot assume that
  3595. everybody will have built and installed the program you're using.
  3596.  
  3597. @node Fractal World, Maze World, Synthesis Method List, Synthesis Methods
  3598.  
  3599. @subsection Fractal World
  3600.  
  3601. The fractal world synthesizer can make a variety of natural-looking terrain.
  3602. It relies on a number of parameters to govern a single algorithm.
  3603.  
  3604. @deffn SynthesisMethod @code{make-fractal-percentile-terrain}
  3605. This method generates the terrain layer of a world.
  3606. It works by generating two distinct layers of random blobs,
  3607. known as the ``alt'' and ``wet'' layers,
  3608. then decides on a terrain type for each cell.
  3609. If elevations are defined,
  3610. then this method will use the ``alt'' layer to produce elevations.
  3611. @end deffn
  3612.  
  3613. @deffn GlobalVariable @code{alt-blob-density} n
  3614. @end deffn
  3615. @deffn GlobalVariable @code{wet-blob-density} n
  3616. These variables are the number of blobs to put down,
  3617. expressed as number per 10,000 cells.
  3618. Defaults to @code{500}.
  3619. @end deffn
  3620.  
  3621. @deffn GlobalVariable @code{alt-blob-size} n.f%
  3622. @end deffn
  3623. @deffn GlobalVariable @code{wet-blob-size} n.f%
  3624. These variables are the average number of cells in a blob,
  3625. expressed as number per 10,000 cells.
  3626. Defaults to @code{100}.
  3627. @end deffn
  3628.  
  3629. @deffn GlobalVariable @code{alt-blob-height} n
  3630. @end deffn
  3631. @deffn GlobalVariable @code{wet-blob-height} n
  3632. These variables are the amounts by which to increment or decrement within a blob.
  3633. Defaults to @code{1000}.
  3634. @end deffn
  3635.  
  3636. @deffn GlobalVariable @code{alt-smoothing} n
  3637. @end deffn
  3638. @deffn GlobalVariable @code{wet-smoothing} n
  3639. These variables specify the number of averaging steps
  3640. to perform after the blobs have been generated.
  3641. Defaults to @code{2}.
  3642. @end deffn
  3643.  
  3644. @deffn TerrainTypeProperty @code{alt-percentile-min} n%
  3645. @end deffn
  3646. @deffn TerrainTypeProperty @code{alt-percentile-max} n%
  3647. @end deffn
  3648. @deffn TerrainTypeProperty @code{wet-percentile-min} n%
  3649. @end deffn
  3650. @deffn TerrainTypeProperty @code{wet-percentile-max} n%
  3651. These properties are
  3652. the percentiles of elevations and moistures that result in the given
  3653. terrain type.
  3654. Percentile ranges may overlap, in which case the earlier-defined
  3655. terrain type will be used.
  3656. If a cell has a alt and wet that does not fall in any of the ranges,
  3657. then terrain type 0 will be used there and players will be warned.
  3658. Mins defaults to @code{0}, maxes to @code{100}.
  3659. @end deffn
  3660.  
  3661. After the terrain has been assigned types, the method will give
  3662. a single type to all the cells on the edge of the area.
  3663.  
  3664. @deffn GlobalVariable @code{edge-terrain}
  3665. This variable is the type of terrain to fill in on all the edges of a world.
  3666. The edges of a world have little or no effect on the game,
  3667. but the terrain type should be something distinctive, so that players
  3668. can recognize the edges easily.  (For instance, ice is usually a good choice
  3669. for edges, but probably not on a map of Antarctica!)
  3670. Defaults to terrain type 0 (the first defined type).
  3671. @end deffn
  3672.  
  3673. @node Maze World, Random World, Fractal World, Synthesis Methods
  3674.  
  3675. @subsection Maze World
  3676.  
  3677. A maze consists of a set of randomly placed ``rooms'' connected by random
  3678. passages.
  3679.  
  3680. @deffn SynthesisMethod @code{make-maze-terrain}
  3681. This method creates terrain that looks like a maze.
  3682. It starts by randomly assigning terrain according to its @code{occurrence},
  3683. similarly to @code{make-random-terrain} below, then carves
  3684. out rooms and passages, filling each of those with terrain
  3685. types according to their respective occurrences.
  3686. @end deffn
  3687.  
  3688. @deffn TerrainTypeProperty @code{maze-room-occurrence} n
  3689. This property is the weighted amount of this terrain type
  3690. in rooms in the maze.
  3691. Defaults to @code{0}.
  3692. @end deffn
  3693.  
  3694. @deffn TerrainTypeProperty @code{maze-passage-occurrence} n
  3695. This property is the weighted amount of this terrain type
  3696. in passageways in the maze.
  3697. Defaults to @code{0}.
  3698. @end deffn
  3699.  
  3700. @deffn GlobalVariable @code{maze-room-density} n
  3701. This variable is the fraction of the maze that is room,
  3702. expressed as the number of cells per 10,000 cells in the area.
  3703. Defaults to @code{1000}.
  3704. @end deffn
  3705.  
  3706. @deffn GlobalVariable @code{maze-passage-density} n
  3707. This variable is the fraction of the area that is passageway,
  3708. expressed as the number of cells per 10,000 cells in the area.
  3709. Defaults to @code{3000}.
  3710. @end deffn
  3711.  
  3712. This method will apply edge terrain as a last step.
  3713.  
  3714. @node Random World, Earthlike World, Maze World, Synthesis Methods
  3715.  
  3716. @subsection Random World
  3717.  
  3718. The random world generator just assigns terrain and elevations randomly.
  3719.  
  3720. @deffn SynthesisMethod @code{make-random-terrain}
  3721. This method generates completely random terrain.
  3722. It uses a simple weighting to govern how much
  3723. of each terrain type appears, and makes random elevations as well.
  3724. @end deffn
  3725.  
  3726. @deffn TerrainTypeProperty @code{occurrence} n
  3727. This property is the percentage of the world that will be of this type,
  3728. if the terrain is cell terrain.
  3729. If the terrain is border or connection, it is the probability
  3730. (expressed as .01% increments) that any direction of any cell
  3731. will have that border or connection.
  3732. Defaults to @code{1}.
  3733. @end deffn
  3734.  
  3735. @node Earthlike World, Making Rivers, Random World, Synthesis Methods
  3736.  
  3737. @subsection Earthlike World
  3738.  
  3739. Earthlike generation uses algorithms that more closely approximate
  3740. realistic terrain.
  3741.  
  3742. @deffn SynthesisMethod @code{make-earthlike-terrain}
  3743. This method generates terrain that approximates what actually
  3744. appears on Earth.
  3745. @end deffn
  3746.  
  3747. @node Making Rivers, Making Roads, Earthlike World, Synthesis Methods
  3748.  
  3749. @subsection Making Rivers
  3750.  
  3751. Rivers are borders or connections consisting of ``watery terrain''
  3752. that run downhill to regions of water.
  3753.  
  3754. @deffn SynthesisMethod @code{make-rivers}
  3755. This method looks for a border or connection
  3756. terrain type with a @code{subtype-x} of @code{river-x}.
  3757. then uses the world's elevation data to run rivers downhill
  3758. (always choosing the lowest of possible adjacent locations)
  3759. until they reach cell terrain with a @code{subtype} > 0.
  3760. This method will not run if there are no appropriate terrain types,
  3761. nor if there is no elevation data.
  3762. @end deffn
  3763.  
  3764. @deffn TerrainTypeProperty @code{river-chance} n%
  3765. This property is the chance that a river will start in or around a cell of this
  3766. terrain type.
  3767. Defaults to @code{0}.
  3768. @end deffn
  3769.  
  3770. @deffn GlobalVariable @code{river-sink-terrain} t
  3771. If the value of this variable is a terrain type, then a cell completely
  3772. surrounded by river will be changed to be this type.
  3773. Defaults to @code{non-terrain}.
  3774. @end deffn
  3775.  
  3776. Note that the algorithm computes rivers in a deterministic way,
  3777. so high values of @code{river-chance} do not result in tangled rivers.
  3778.  
  3779. @node Making Roads, Making Countries, Making Rivers, Synthesis Methods
  3780.  
  3781. @subsection Making Roads
  3782.  
  3783. The road generation method makes networks of connection terrain between
  3784. particular unit types, usually those resembling cities.
  3785.  
  3786. @deffn SynthesisMethod @code{make-roads}
  3787. This methods synthesizes roads for an area.
  3788. For any connection type of terrain, if no layer has been created for it
  3789. already, and the type has a @code{subtype-x} of 3,
  3790. put down roads between any pair of units whose
  3791. @code{road-chance} is nonzero.
  3792. The method will attempt to share road routes whenever possible,
  3793. and choose terrain according to @code{road-into-chance}.
  3794. In addition, the method may also generate spur roads connecting
  3795. units to existing roads, and run roads from one edge of the
  3796. area to another.
  3797. @end deffn
  3798.  
  3799. @deffn Table @code{road-chance} u1 u2 -> n%
  3800. This table is the chance that a road will be laid, running
  3801. from a unit of type @var{u1} to one of type @var{u2}.
  3802. Note that is not a symmetrical relationship;
  3803. since roads follow random paths, if the @code{road-chance}
  3804. causes a road to be laid from @var{u1} to @var{u2},
  3805. and another from @var{u2} to @var{u1}, it is quite possible
  3806. that the result will be two different roads connecting
  3807. the two units.
  3808. Defaults to @code{0}.
  3809. @end deffn
  3810.  
  3811. @deffn Table @code{road-into-chance} t1 t2 -> n%
  3812. This table is the chance that a road will be chosen to pass
  3813. from terrain of type @var{t1} into terrain of type @var{t2}.
  3814. Defaults to @code{100}.
  3815. @end deffn
  3816.  
  3817. @deffn UnitTypeProperty @code{spur-chance} n%
  3818. This property is the percentage chance that the unit will get a spur
  3819. road running from the unit to the nearest existing road.
  3820. Defaults to @code{0}.
  3821. @end deffn
  3822.  
  3823. @deffn UnitTypeProperty @code{spur-range} dist
  3824. This property is the radius of the area that will be searched for an
  3825. existing road.
  3826. Defaults to @code{1}, which results in spurs connecting only to
  3827. roads in adjacent cells.
  3828. @end deffn
  3829.  
  3830. @deffn UnitTypeProperty @code{road-to-edge-chance} n%
  3831. This property is the percentage chance that the unit will have
  3832. a road running from the unit to some edge of the area.
  3833. Defaults to @code{0}.
  3834. @end deffn
  3835.  
  3836. @deffn GlobalVariable @code{edge-road-density} n
  3837. This variable is the density of roads that run from one area edge
  3838. to another, expressed as the number per 10,000 cells in the area.
  3839. (note, not counting just edge cells).
  3840. Defaults to @code{0}.
  3841. @end deffn
  3842.  
  3843. @node Making Countries, Making Independent Units, Making Roads, Synthesis Methods
  3844.  
  3845. @subsection Making Countries
  3846.  
  3847. The @code{make-countries} method sets up the starting units for
  3848. each side, placing them in a confined area, separated from the
  3849. starting units of other sides and taking terrain preferences
  3850. into account.  If requested, this method will also expand the
  3851. country outwards by a specified amount, possibly placing additional
  3852. units in the process.
  3853.  
  3854. @deffn SynthesisMethod @code{make-countries}
  3855. This method works by looking for a likely place for the country,
  3856. randomly places a basic set of starting units within that area,
  3857. then expands the country outwards.
  3858. The parameters give you control over the mix of terrain types
  3859. in the country, as well as the size and relative positions of the
  3860. different countries.
  3861. This method runs on any side with fewer units than it is supposed
  3862. to start with, as given by the parameters below.
  3863. It places groups of units at locations separated from each other
  3864. by specified distances.
  3865. @end deffn
  3866.  
  3867. @deffn GlobalVariable @code{country-radius-min} dist
  3868. This variable is the radius of the country's initial area.
  3869. Defaults to @code{-1}, which allows the algorithm to calculate a ``reasonable''
  3870. country size appropriate to the given number of units.
  3871. @end deffn
  3872.  
  3873. @deffn GlobalVariable @code{country-separation-min} dist
  3874. @end deffn
  3875. @deffn GlobalVariable @code{country-separation-max} dist
  3876. These variables are the minimum and maximum
  3877. distances of country centers from each other, in cells.
  3878. If small, countries will mostly overlap;
  3879. if very large, then attempts to use small worlds will fail;
  3880. if the max and min are too close to each other, placements can also fail.
  3881. For both of these, a value of @code{-1} disables their effect.
  3882. Both default to @code{-1}.
  3883. @end deffn
  3884.  
  3885. The max separation bound needs to be satisfied for a country
  3886. with respect to only @i{one} other country,
  3887. so for instance the final layout may involve a long
  3888. ``string'' of countries where the first and last countries are very far apart
  3889. from each other.
  3890. The minimum bound must be satisfied for all pairs of countries.
  3891.  
  3892. @deffn TerrainTypeProperty @code{country-terrain-min} n
  3893. This property is the minimum amount of terrain
  3894. that must be within the country's initial radius.
  3895. Defaults to @code{0}.
  3896. @end deffn
  3897.  
  3898. @deffn TerrainTypeProperty @code{country-terrain-max} n
  3899. This property is the most terrain of the given type that may appear.
  3900. If @code{-1}, then any amount may be present.
  3901. Defaults to @code{-1}.
  3902. @end deffn
  3903.  
  3904. @deffn UnitTypeProperty @code{start-with} n
  3905. @end deffn
  3906. @deffn UnitTypeProperty @code{independent-near-start} n
  3907. These properties set the number of units of the given type in a player's country.
  3908. These units are randomly scattered within the initial radius,
  3909. and the @code{favored} table (see below) decides which terrains
  3910. will be used.  Units may be placed inside each other; in fact,
  3911. units with no favored terrain will be made into occupants if possible.
  3912.  
  3913. The independent units will be placed after the ones belonging to the side,
  3914. so on the average they will get the less desirable locations in the country.
  3915. Both independent and the side's units will be named using the side's namers.
  3916.  
  3917. Both default to @code{0}.
  3918. @end deffn
  3919.  
  3920. @deffn Table @code{favored-terrain} u t -> n%
  3921. This table sets
  3922. the probability of the unit type being on the given type of terrain at the
  3923. outset.  A value of @code{0} is an absolute prohibition against placing
  3924. the unit on that type of terrain, thus every game must specify at least
  3925. one non-zero value for some terrain type and some initial unit type.
  3926. Defaults to @code{100}.
  3927. @end deffn
  3928.  
  3929. Once the initial country area has been set up,
  3930. then you can allow the countries to expand outwards.
  3931. Expansion occurs at the same rate for all countries.
  3932. Countries may expand into and through each other.
  3933. Expansion occurs as a number of @var{steps}, each step increasing
  3934. the radius of countries by 1 all around.
  3935.  
  3936. @deffn TerrainTypeProperty @code{country-growth-chance} n%
  3937. This property is the chance that a country will expand onto an unclaimed cell
  3938. of the given terrain type.
  3939. Defaults to @code{100}.
  3940. @end deffn
  3941.  
  3942. @deffn TerrainTypeProperty @code{country-takeover-chance} n%
  3943. This property is the chance that a country will expand onto another country's cell
  3944. of the given terrain type.
  3945. Defaults to @code{0}.
  3946. @end deffn
  3947.  
  3948. @deffn UnitTypeProperty @code{unit-growth-chance} n.f%
  3949. This property is the chance that a unit of the given type will be placed
  3950. when the country expands onto a cell.
  3951. The unit will only be placed if the @code{favored} chance is also true.
  3952. Defaults to @code{0}.
  3953. @end deffn
  3954.  
  3955. @deffn UnitTypeProperty @code{independent-growth-chance} n.f%
  3956. This property is the chance that an independent unit of the given type will be placed
  3957. when the country expands onto a cell.
  3958. The @code{favored} chance is also evaluated.
  3959. Defaults to @code{0}.
  3960. @end deffn
  3961.  
  3962. @deffn UnitTypeProperty @code{unit-takeover-chance} n.f%
  3963. This property is the chance that a unit of the given type in another country and
  3964. belonging to another side will be given to the growing side.
  3965. Defaults to @code{0}.
  3966. @end deffn
  3967.  
  3968. @deffn UnitTypeProperty @code{independent-takeover-chance} n.f%
  3969. This property is the chance that an independent unit of the given type in
  3970. another country will be given to the growing side.
  3971. Defaults to @code{0}.
  3972. @end deffn
  3973.  
  3974. @deffn GlobalVariable @code{country-radius-max} dist
  3975. This variable is a cap on the country growth process.
  3976. Values between @code{0} and @code{country-radius-min}
  3977. prevent country growth entirely,
  3978. while a value of @code{-1} allows growth to encompass the entire world.
  3979. Defaults to @code{0}.
  3980. @end deffn
  3981.  
  3982. @deffn UnitTypeProperty @code{country-units-max} n
  3983. This property is a cap on the number of units given to the side's country.
  3984. Defaults to @code{-1}, which disables any limit.
  3985. @end deffn
  3986.  
  3987. @deffn GlobalVariable @code{growth-stop-chance} n%
  3988. This variable is the chance that a country's growth will stop,
  3989. if during the current step no new cells were added
  3990. to the country.
  3991. Defaults to @code{0}.
  3992. @end deffn
  3993.  
  3994. @deffn TerrainTypeProperty @code{country-people-chance} n%
  3995. This property is the chance that the people's side will be changed to
  3996. match that for the country they are in.
  3997. Defaults to @code{100}.
  3998. @end deffn
  3999.  
  4000. @node Making Independent Units, Making Weather, Making Countries, Synthesis Methods
  4001.  
  4002. @subsection Making Independent Units
  4003.  
  4004. @deffn SynthesisMethod @code{make-independent-units}
  4005. This method scatters independent units randomly
  4006. over the world.
  4007. This method will not run if the specified density of independent units
  4008. has already
  4009. been achieved, for instance from a predefined world or from country placement.
  4010. Independent units that should be inside other independents will be
  4011. handled correctly.
  4012. @end deffn
  4013.  
  4014. @deffn Table @code{independent-density} u t -> n
  4015. This table is the total number of independent units appearing throughout the world,
  4016. at the rate of @var{n} per 10,000 cells
  4017. of the given terrain type.
  4018. Any independent units already placed are counted first,
  4019. so this value represents final density.
  4020. If the sum of values for a given unit type on all terrain types is nonzero,
  4021. then at least one unit of that type will
  4022. be placed, even if the world is very small (i.e. the calculation of
  4023. numbers rounds up not down).
  4024. Defaults to @code{0}.
  4025. @end deffn
  4026.  
  4027. This method uses the @code{favored-terrain} table as the chance that a given
  4028. unit will be placed at a randomly-chosen position,
  4029. and it will keep trying different positions until a suitable one is
  4030. found.
  4031.  
  4032. @deffn TerrainTypeProperty @code{independent-people-chance} .01n%
  4033. This property is the chance that the people of a cell with this terrain type
  4034. will be made independent.
  4035. Deafults to @code{0}.
  4036. @end deffn
  4037.  
  4038. @node Making Weather, Making Initial Supply, Making Independent Units, Synthesis Methods
  4039.  
  4040. @subsection Making Weather
  4041.  
  4042. Weather synthesis sets up an initial state for the weather.
  4043.  
  4044. @deffn SynthesisMethod @code{make-weather}
  4045. This method sets up weather-related layers,
  4046. including temperature, winds, and clouds.
  4047. @end deffn
  4048.  
  4049. @node Making Initial Supply, Naming Geographical Features, Making Weather, Synthesis Methods
  4050.  
  4051. @subsection Making Initial Supply
  4052.  
  4053. By default, all units start out empty of materials.
  4054. The supply initialization method gives each unit a starting supply,
  4055. according to the stockpile tables.
  4056.  
  4057. @deffn SynthesisMethod @code{make-initial-materials}
  4058. This method fills unit and cell supplies to specified levels.
  4059. It will fill all units in existence at the moment it runs,
  4060. including units that have not appeared yet.
  4061. Similarly, all cells will be filled.
  4062. @end deffn
  4063.  
  4064. @deffn Table @code{unit-initial-supply} u m -> n
  4065. This table is the amount of each material that each unit will start out with.
  4066. If the initial supply is greater than unit's capacity,
  4067. then the unit will just be filled to capacity.
  4068. Defaults to @code{0}.
  4069. @end deffn
  4070.  
  4071. @deffn Table @code{terrain-initial-supply} t m -> n
  4072. This table is the amount of material @var{m} that each cell
  4073. with terrain @var{t} will start out with.
  4074. This will be limited by the cell's capacity.
  4075. Defaults to @code{0}.
  4076. @end deffn
  4077.  
  4078. @node Naming Geographical Features, Naming Units, Making Initial Supply, Synthesis Methods
  4079.  
  4080. @subsection Naming Geographical Features
  4081.  
  4082. Although named geographical features don't affect the outcome of a game
  4083. in any way, they are useful for ``color'' and for identifying locations
  4084. more readably.
  4085.  
  4086. @deffn SynthesisMethod @code{name-geographical-features}
  4087. This method identifies and names regions as geographical features,
  4088. such as mountain ranges and islands.
  4089. @end deffn
  4090.  
  4091. @deffn GlobalVariable @code{feature-namers} feature-namer-list
  4092. This variable is a list of feature types and their associated namers.
  4093. This is used for features not intersecting any country
  4094. with a namer for the feature's type.
  4095. Defaults to @code{()}.
  4096. @end deffn
  4097.  
  4098. @deffn GlobalVariable @code{feature-types} feature-expr-list
  4099. This variable is a list of feature types that may be identified.
  4100. Examples: @code{("lake" (group (sea shallows) 1))},
  4101. @code{("peak" (high-point 1 1))}
  4102.  
  4103. Defaults to @code{()}.
  4104. @end deffn
  4105.  
  4106. [need to document recognized feature types]
  4107.  
  4108. @node Naming Units, Making a Random Date, Naming Geographical Features, Synthesis Methods
  4109.  
  4110. @subsection Naming Units
  4111.  
  4112. @deffn SynthesisMethod @code{name-units-randomly}
  4113. This method gives names to previously-unnamed units,
  4114. using their usual namers.
  4115. @end deffn
  4116.  
  4117. @node Making a Random Date,  , Naming Units, Synthesis Methods
  4118.  
  4119. @subsection Making a Random Date
  4120.  
  4121. For extra color, games can be set up to start at a random date
  4122. within a given range.  If day or year effects are defined,
  4123. this also has the effect of making the game start at a random
  4124. time of day or year.
  4125.  
  4126. @deffn SynthesisMethod @code{make-random-date}
  4127. This method generates a random starting date, within specified
  4128. bounds.
  4129. @end deffn
  4130.  
  4131. @deffn GlobalVariable @code{initial-date-min} date
  4132. This variable is the earliest possible date for the game.
  4133. Defaults to @code{""}.
  4134. @end deffn
  4135.  
  4136. @deffn GlobalVariable @code{initial-date-max} date
  4137. This variable is the latest possible date for the game.
  4138. Defaults to @code{""}.
  4139. @end deffn
  4140.  
  4141. @node Setup Postprocessing, Naming and Text Generation, Synthesis Methods, Reference Manual
  4142.  
  4143. @section Setup Postprocessing
  4144.  
  4145. Some initialization steps will be done after all synthesis methods
  4146. have been run.  @i{Xconq} will always do these.
  4147.  
  4148. @menu
  4149. * Initial View::
  4150. @end menu
  4151.  
  4152. @node Initial View, , Setup Postprocessing, Setup Postprocessing
  4153.  
  4154. @subsection Initial View
  4155.  
  4156. By default, each side starts out knowing only what its units can
  4157. normally see at the beginning of the first turn.
  4158. These parameters add to that initial view.
  4159.  
  4160. @deffn GlobalVariable @code{terrain-seen} t/f
  4161. This variable is @code{true} if all the terrain of the world is known initially.
  4162. Defaults to @code{false}.
  4163. @end deffn
  4164.  
  4165. @deffn UnitTypeProperty @code{initial-seen-radius} dist
  4166. This property specifies the radius of the area seen around each of
  4167. the starting units.
  4168. It computes visibility of terrain (cells and borders) only.
  4169. Defaults to @code{1} (which is a no-op if the unit's @code{vision-range}
  4170. is greater than or equal to 1).
  4171. @end deffn
  4172.  
  4173. @deffn UnitTypeProperty @code{already-seen} n%
  4174. This property is the chance to see units of this type at
  4175. the beginning of the game.
  4176. This applies only to units belonging to another side,
  4177. and on known terrain.
  4178. The effect is one-time, so if an @code{already-seen} unit changes
  4179. sides later on, other players will not see the change unless
  4180. they have the unit under observation for themselves.
  4181. Note that @code{see-always} implies @code{already-seen}.
  4182. Defaults to @code{0}.
  4183. @end deffn
  4184.  
  4185. @deffn UnitTypeProperty @code{already-seen-independent} n%
  4186. This property is like @code{already-seen},
  4187. but applies to independent units specifically.
  4188. Defaults to @code{0}.
  4189. @end deffn
  4190.  
  4191. @node Naming and Text Generation, Actions, Setup Postprocessing, Reference Manual
  4192.  
  4193. @section Naming and Text Generation
  4194.  
  4195. @i{Xconq} can generate names for sides, units, and geographical features.
  4196. Although most naming happens during game setup, names may be assigned
  4197. throughout the course of a game, both automatically and by player request.
  4198.  
  4199. @menu
  4200. * Naming Sides::                
  4201. * Namers::                      
  4202. * Naming Methods::              
  4203. @end menu
  4204.  
  4205. @node Naming Sides, Namers, Naming and Text Generation, Naming and Text Generation
  4206.  
  4207. @subsection Naming Sides
  4208.  
  4209. Side naming is special, because several different but related names
  4210. have to be produced.
  4211.  
  4212. @deffn Variable @code{side-library} side-info@dots{}
  4213. This variable is a weighted list of groups of side properties,
  4214. each of which may be used to fill in a side.
  4215. @end deffn
  4216.  
  4217. The form of each side name entry is basically a subset of the
  4218. side's properties:
  4219. @example
  4220. ([ weight ] ... (name <name>) ... (color <colors>) ...)
  4221. @end example
  4222. Each entry can include as many or as few of the attributes as desired;
  4223. any missing will be filled in from the usual defaults.
  4224. The optional @var{weight} is a number that adjusts the probability of selection
  4225. of the given side name set; it defaults to 1, and the probability is scaled
  4226. according to the sum of the weights for all the sides listed.
  4227. If any property value is a namer, then the namer will be run.
  4228. (Note that if multiple namers are specified, they cannot be guaranteed
  4229. to coordinate with each other, so you can end up with a side noun
  4230. that is inappropriate for its corresponding side name.)
  4231.  
  4232. @node Namers, Naming Methods, Naming Sides, Naming and Text Generation
  4233.  
  4234. @subsection Namers
  4235.  
  4236. Since one of the purposes of naming is to identify objects uniquely,
  4237. any name generator should be able to maintain some memory as to
  4238. what has been generated already.
  4239. The objects that do this are @dfn{namers}.
  4240.  
  4241. @deffn Form @code{namer} [ symbol/id ] method rejects@dots{}
  4242. This form defines an instance of a namer, with either the symbolic
  4243. name or numeric id.  If either matches the name or id of an existing
  4244. namer, then the old namer will be overwritten, otherwise a new one
  4245. will be created.
  4246. The @var{method} must be one of the naming methods listed below,
  4247. and @var{rejects} defines what names may not be produced (its exact
  4248. interpretation depends on the method).
  4249. @end deffn
  4250.  
  4251. @node Naming Methods,  , Namers, Naming and Text Generation
  4252.  
  4253. @subsection Naming Methods
  4254.  
  4255. As with general synthesis, @i{Xconq} has a number of @dfn{naming methods}
  4256. available.
  4257.  
  4258. An implementation is free to define additional naming methods.
  4259.  
  4260. @deffn NamingMethod @code{random} names @dots{}
  4261. This method picks a name from the given list of names
  4262. and removes that name from the list.
  4263. @end deffn
  4264.  
  4265. @deffn NamingMethod @code{junky}
  4266. This method produces a gobbledy-gook name, very techy-looking.
  4267. @end deffn
  4268.  
  4269. @deffn NamingMethod @code{grammar} root max-length rules@dots{}
  4270. This method defines a grammar, where @var{root} is the root symbol,
  4271. @var{max-length} is a limit on the length of the generated names
  4272. (in characters),
  4273. and @var{rules} is a list of rules of the form
  4274. @example
  4275. (@var{symbol} ([sym] [weight] @var{symbol/string/list} [n] @dots{}))
  4276. @end example
  4277. @end deffn
  4278.  
  4279. The generation process works by substituting one of the rule's alternatives
  4280. for the symbol, starting with the root symbol.
  4281. The probability of an alternative being selected is arrived at by
  4282. adding up the optional weights @var{weight} (assuming missing weights
  4283. to be @code{1}), and choosing with a probability of the weight
  4284. divided by the total sum of weights.
  4285. Thus the weights need not add up to any particular value.
  4286.  
  4287. Strings get used directly.
  4288. If a symbol in the rule's chosen expansion does not appear as the 
  4289. lefthand side in any rule, then it will be handled as a string,
  4290. otherwise it will be expanded in turn.
  4291. If the symbol matches a namer's name, then that namer will be
  4292. run (passing the same object??) and its result incorporated.
  4293. A list should be a list of strings and symbols, and the expansion
  4294. of each will be concatenated.
  4295.  
  4296. @deffn GlobalConstant @code{any}
  4297. @end deffn
  4298.  
  4299. @deffn GlobalConstant @code{or}
  4300. @end deffn
  4301.  
  4302. @deffn GlobalConstant @code{reject}
  4303. A special rule headed by @code{reject} is a list of substrings
  4304. that should not appear in a generated name; this is a convenient
  4305. way to filter out particularly unlovely results.
  4306. @end deffn
  4307.  
  4308. @deffn GlobalConstant @code{capitalize}
  4309. Directs capitalization of a nonterminal.
  4310. @end deffn
  4311.  
  4312. [text is not actually different from a namer?]
  4313.  
  4314. @deffn Form @code{text} [ symbol/id ] method rejects@dots{}
  4315. @end deffn
  4316.  
  4317. @deffn GlobalVariable @code{action-messages} patterns
  4318. @end deffn
  4319.  
  4320. @deffn GlobalVariable @code{event-messages} patterns
  4321. @end deffn
  4322.  
  4323. @node Actions, Backdrop Environment Parameters, Naming and Text Generation, Reference Manual
  4324.  
  4325. @section Actions
  4326.  
  4327. The parameters in this section define and regulate the various actions that are
  4328. available to units during a game.
  4329.  
  4330. Actions always start and complete (including all of their effects)
  4331. within the same turn, and a unit can only do one at a time.
  4332.  
  4333. All actions are potentially available to all units, but the parameters
  4334. can be set so as to deny any action type to any unit type.
  4335. See the descriptions with each action type.
  4336.  
  4337. All action is limited by action points.
  4338. Each unit gets a certain number at the beginning of each
  4339. turn and expends them in the course of doing things.
  4340. The usual expenditure is
  4341. one point per action, but may be more, as defined for each type of action.
  4342. A unit action must always consume at least one action point.
  4343. Units can accumulate acp from turn to turn, and they can also reduce
  4344. acp below zero.
  4345.  
  4346. @menu
  4347. * Actions in General::
  4348. * Action Ordering:: 
  4349. * Movement Action::
  4350. * Entry Action::
  4351. * Research Action::            
  4352. * Toolup Action::              
  4353. * Unit Creation Actions::       
  4354. * Unit Completion Action::
  4355. * Repair Action::
  4356. * Material Production Action::
  4357. * Material Transfer Action::
  4358. * Side Change Action::
  4359. * Disband Action::
  4360. * Part Transfer Action::
  4361. * Type Change Action::         
  4362. * Combat Actions::             
  4363. * Capture Action::             
  4364. * Detonation Action::
  4365. * Terrain Alteration Actions::
  4366. @end menu
  4367.  
  4368. @node Actions in General, Action Ordering, Actions, Actions
  4369.  
  4370. @subsection Actions in General
  4371.  
  4372. @deffn UnitTypeProperty @code{acp-per-turn} acp
  4373. This property is the basic allowance of action points that a unit gets each turn.
  4374. Defaults to @code{0}.
  4375. @end deffn
  4376.  
  4377. @deffn UnitTypeProperty @code{acp-min} acp
  4378. This property specifies how far into ``action debt'' a unit can go
  4379. during a turn before it is prevented entirely from acting.
  4380. A unit with acp < 1 at the beginning of a turn cannot do anything at all.
  4381. Defaults to @code{0}.
  4382. @end deffn
  4383.  
  4384. @deffn UnitTypeProperty @code{acp-max} acp
  4385. This property is
  4386. the maximum number of action points that a unit can save up.
  4387. The value @code{-1} means that @code{acp-max} is equal to @code{acp}.
  4388. Extra acp is silently lost.
  4389. Defaults to @code{-1}. 
  4390. @end deffn
  4391.  
  4392. @deffn UnitTypeProperty @code{free-acp} acp
  4393. This property is
  4394. the value is the amount by which the action points for some
  4395. action can exceed the unit's currently available acp
  4396. and still allow that action.
  4397. Defaults to @code{-1}, which means enough free acp to
  4398. allow any action.
  4399. @end deffn
  4400.  
  4401. Note that a unit with an acp of 0 is completely unintelligent, about like
  4402. a cow patty.  Cow patties can be useful for blocking paths, hiding behind,
  4403. and suchlike, and have the advantage that once they're in place, you don't
  4404. have to manage them.  Other units will have to pick them up and put them
  4405. down, of course.
  4406.  
  4407. @deffn Table @code{material-to-act} u m -> n
  4408. This table is a minimum amount of @var{m} needed for @var{u} to be able to act.
  4409. The material is not consumed.
  4410. Defaults to @code{0}.
  4411. @end deffn
  4412.  
  4413. @deffn UnitTypeProperty @code{acp-damage-effect} interpolation-list
  4414. This property is the effect of a unit's hp on its acp.
  4415. The input value is hp, while the output value is the acp to be added
  4416. instead of @code{acp-per-turn}.
  4417. This list does not extrapolate.
  4418. Defaults to @code{()}.
  4419. @end deffn
  4420.  
  4421. @deffn Table @code{acp-night-effect} u t -> n
  4422. This table is the multiplier for unit's acp at night in each type of terrain.
  4423. Defaults to @code{100}.
  4424. @end deffn
  4425.  
  4426. @deffn Table @code{acp-occupant-effect} u1 u2 -> n
  4427. Defaults to @code{100}.
  4428. @end deffn
  4429.  
  4430. @deffn UnitTypeProperty @code{acp-per-turn-min} acp
  4431. This property sets a lower limit on the effect of occupants,
  4432. damage, and other modifiers on the acp to be added at the beginning
  4433. of the turn.
  4434. Defaults to @code{0}.
  4435. @end deffn
  4436.  
  4437. @deffn UnitTypeProperty @code{acp-per-turn-max} acp
  4438. This property set the upper limit on the effect of occupants
  4439. and other modifiers to the acp added at the beginning of the turn.
  4440. Defaults to @code{-1}, which indicate no limit.
  4441. @end deffn
  4442.  
  4443. @node Action Ordering, Movement Action, Actions in General, Actions
  4444.  
  4445. @subsection Action Ordering
  4446.  
  4447. @deffn GlobalVariable @code{use-side-priority} t/f
  4448. This variable is @code{true} if the sides may only act one at a time;
  4449. otherwise, all sides and units may move simultaneously during a turn.
  4450. Defaults to @code{false}.
  4451. @end deffn
  4452.  
  4453. @deffn UnitTypeProperty @code{action-priority} n
  4454. This property is the order in which units of this type will act.
  4455. Higher numbers act earlier.
  4456. If the difference between the priority of one type and another
  4457. is greater than 100, then the earlier-acting units must finish acting
  4458. before the later-acting units, otherwise a player can rearrange the actual
  4459. acting order as desired.
  4460. Defaults to @code{0}.
  4461. @end deffn
  4462.  
  4463. @node Movement Action, Entry Action, Action Ordering, Actions
  4464.  
  4465. @subsection Movement Action
  4466.  
  4467. Movement is the most common sort of action.
  4468. This section covers movement over open terrain;
  4469. the next section discusses interaction with transports.
  4470.  
  4471. The general theory of movement is that a unit not in a transport
  4472. crosses its current cell terrain to the edge of the cell,
  4473. crosses any border terrain, and then moves into the destination cell,
  4474. OR it moves onto connection terrain,
  4475. travels along connection terrain to the new cell, and maybe 
  4476. moves off the connection.
  4477. If the unit starts in a transport, then the transport may ferry
  4478. the unit over some of the intervening terrain,
  4479. possibly as far as the unit's destination.
  4480.  
  4481. A unit's basic movement rate is defined by its @dfn{speed},
  4482. which is a ratio of the the unit's acp.
  4483. A speed of 100% means that the unit can potentially
  4484. enter as many cells as it has acp,
  4485. while a speed of 20% means that the unit uses at least
  4486. 5 acp to enter a cell.
  4487.  
  4488. Movement can only succeed if several conditions are met:
  4489. the unit must be able to cross
  4490. the border terrain, the destination must be inside the world (but see below),
  4491. it must be able to exist on the terrain of the destination.
  4492.  
  4493. @deffn ActionType @code{move} x y z
  4494. This is the action that a unit performs to go from its current
  4495. location to the cell at @var{x,y} at altitude @var{z}.
  4496. The destination must be within the @code{move-range} of the unit.
  4497. @end deffn
  4498.  
  4499. @deffn UnitTypeProperty @code{acp-to-move} acp
  4500. This property is the number of acp a unit uses to do one move action.
  4501. Defaults to @code{1}.
  4502. @end deffn
  4503.  
  4504. @deffn UnitTypeProperty @code{speed} n
  4505. This property is the basic multiplier relating acp to the number
  4506. of cells that may be entered during a turn.
  4507. Defaults to @code{100}.
  4508. @end deffn
  4509.  
  4510. @deffn UnitTypeProperty @code{speed-damage-effect} interpolation-list
  4511. This property is the unit's speed if it is damaged.
  4512. The input value is the unit's hp, while the result value is the
  4513. unit speed to use instead of @code{speed}.
  4514. Defaults to @code{()}.
  4515. @end deffn
  4516.  
  4517. @deffn Table @code{speed-occupant-effect} u1 u2 -> n%
  4518. This table is the percent change in the speed
  4519. of type @var{u1} for each occupant of type @var{u2}.
  4520. If the basic speed of @var{u1} is @code{0},
  4521. then the multiplication is performed
  4522. as if the speed were @code{1} instead.
  4523. Defaults to @code{100}.
  4524. @end deffn
  4525.  
  4526. @deffn UnitTypeProperty @code{speed-wind-effect} list
  4527. This property is a list that describes the effect of wind
  4528. on the unit's speed.  The effect is calculated using the
  4529. wind in the cell that the unit is entering (not its current
  4530. location?).  The form of the list is
  4531. @example
  4532. ((<angle-list> <value>) ...),
  4533. <value> = <number> | ((<force> <number>) (<force> <number>) ...)
  4534. @end example
  4535. where @i{angle-list} is a single number, list of number, or the
  4536. symbol @code{all}.  For hex areas, the angles are 0 for downwind
  4537. (same direction), 1, 2, and 3 for directly upwind (opposite direction).
  4538. The @i{force} is the wind force in the cell, and @i{number} is the
  4539. multiplier for the speed, with @code{100} having no effect, numbers
  4540. less than @code{100} decreasing the unit's speed, and numbers greater
  4541. than @code{100} increasing it.
  4542. Defaults to @code{()}.
  4543. @end deffn
  4544.  
  4545. @deffn UnitTypeProperty @code{speed-min} mp
  4546. This property is the worst-case speed of a unit.
  4547. Defaults to @code{0}.
  4548. @end deffn
  4549.  
  4550. @deffn UnitTypeProperty @code{speed-max} mp
  4551. This property is the upper bound on a unit's movement in one turn. (?)
  4552. Defaults to @code{0}.
  4553. @end deffn
  4554.  
  4555. @deffn UnitTypeProperty @code{move-range} n
  4556. This property is the maximum distance allowed to the destination cell.
  4557. Defaults to @code{1}.
  4558. @end deffn
  4559.  
  4560. The product of a unit's acp and its speed is its available @dfn{movement points}.
  4561. Any move between cells will cost at least one movement point.
  4562. Some mp costs may be negative, but the total mp for a move will always
  4563. be at least 1.
  4564.  
  4565. @deffn Table @code{mp-to-leave-terrain} u t -> mp
  4566. This table is the mp cost to leave a cell of type @var{t}.
  4567. If @var{t} is a border type, this cost is never used.
  4568. If @var{t} is a connection type, this cost is the cost of leaving the
  4569. connection terrain for the open terrain of the cell.
  4570. If @var{t} is a coating type, then this value adds to the cost
  4571. of leaving the cell.
  4572. Defaults to @code{0}.
  4573. @end deffn
  4574.  
  4575. @deffn Table @code{mp-to-enter-terrain} u t -> mp
  4576. This table is the mp cost to enter a cell of type @var{t}.
  4577. If @var{t} is a border type, this cost is the
  4578. cost of crossing the border.
  4579. If @var{t} is a connection type, this cost is the cost of entering the
  4580. connection terrain from the open terrain of the cell.
  4581. If @var{t} is a coating type, then this value adds to the cost
  4582. of entering the cell.
  4583. Defaults to @code{1}.
  4584. @end deffn
  4585.  
  4586. @deffn Table @code{mp-to-traverse} u t -> mp
  4587. This table gives the cost to travel
  4588. along a connection or border of the given type.
  4589. (note that the other costs are irrelevant if
  4590. unit starts and ends its movement on the connection).
  4591.  
  4592. A special type of move known as a @dfn{border slide} can occur when the
  4593. endpoints of a border touch on the start and destination cells.
  4594. Sliding works like normal movement
  4595. that happens to end up on a nonadjacent cell.
  4596. Same rules for permissibility apply.
  4597. If the value is negative, then border sliding is not possible.
  4598.  
  4599. Defaults to @code{1}.
  4600. @end deffn
  4601.  
  4602. If both enter/traverse/leave and enter/leave movement is possible,
  4603. then @i{Xconq} will automatically choose the cheapest alternative.
  4604.  
  4605. Each unit type has a range of altitudes within which it normally operates.
  4606.  
  4607. @deffn Table @code{altitude-min} u t -> n
  4608. This table is the minimum altitude possible for each type of unit
  4609. on each type of terrain.
  4610. Defaults to @code{0}.
  4611. @end deffn
  4612.  
  4613. @deffn Table @code{altitude-max} u t -> n
  4614. This table is the maximum altitude possible for each type of unit
  4615. on each type of terrain.
  4616. Defaults to @code{0}.
  4617. @end deffn
  4618.  
  4619. @deffn UnitTypeProperty @code{mp-to-leave-world} mp
  4620. This property is an additional move cost to leave the world entirely.
  4621. To leave, the unit must be within its @code{move-range} of an edge,
  4622. and have sufficient mp to move into the terrain in the edge cell
  4623. designated as the destination of the move.
  4624. If the value is @code{-1}, then the unit may never leave.
  4625. Defaults to @code{-1}.
  4626. @end deffn
  4627.  
  4628. @deffn UnitTypeProperty @code{free-mp} mp
  4629. This property is the amount by which the move points can ``go into the red''
  4630. and still allow one more move.
  4631. Defaults to @code{0}.
  4632. @end deffn
  4633.  
  4634. ZOC is exerted only over units out in the open, has no effect on occupants,
  4635. unless they leave their transport.
  4636. Occupants can themselves exert a ZOC,
  4637. if @code{occupant-can-fight} is true.
  4638. ZOC applies to all units on a hostile side.
  4639.  
  4640. @deffn Table @code{zoc-range} u1 u2 -> dist
  4641. This table is the maximum distance at which type @var{u1}
  4642. exerts a ZOC over type @var{u2}.
  4643. A value of @code{0} means that the unit controls only its own cell,
  4644. and a value of @code{-1} means that the unit does not exert a ZOC at all.
  4645. Defaults to @code{0}.
  4646. @end deffn
  4647.  
  4648. @deffn Table @code{zoc-into-terrain} u t -> t/f
  4649. This table is @code{true} if the unit exerts its ZOC into terrain @var{t}.
  4650. Defaults to @code{true}.
  4651. @end deffn
  4652.  
  4653. @deffn Table @code{zoc-from-terrain-effect} u t -> n
  4654. Defaults to @code{100}.
  4655. @end deffn
  4656.  
  4657. @deffn Table @code{mp-to-enter-zoc} u1 u2 -> mp
  4658. This table specifies extra movement points needed to enter the ZOC.
  4659. @code{-1} prevents entry entirely.
  4660. Defaults to @code{-1}.
  4661. @end deffn
  4662.  
  4663. @deffn Table @code{mp-to-leave-zoc} u1 u2 -> mp
  4664. This table specifies extra movement points needed to leave the ZOC.
  4665. @code{-1} prevents departure entirely.
  4666. Defaults to @code{0}.
  4667. @end deffn
  4668.  
  4669. @deffn Table @code{mp-to-traverse-zoc} u1 u2 -> mp
  4670. This table specifies extra movement points needed to move within the ZOC.
  4671. @code{-1} prevents traversing entirely.
  4672. Defaults to @code{0}.
  4673. @end deffn
  4674.  
  4675. If multiple units exert a ZOC into the same cell, then the mp cost
  4676. is the maximum of the different ZOC costs.
  4677.  
  4678. Units may use up some of their materials when they move.
  4679. Consumption happens after the move action, and only for successful moves.
  4680.  
  4681. @deffn Table @code{material-to-move} u m -> n
  4682. This table is the amount of each material that a unit of type @var{u}
  4683. must have in order to be able to move.
  4684. Defaults to @code{0}.
  4685. @end deffn
  4686.  
  4687. @deffn Table @code{consumption-per-move} u m -> n
  4688. This table is the amount of each material used by a unit to do one move action.
  4689. The amount taken is independent of terrain.
  4690. If the unit has less than the required amount of any of these materials,
  4691. it is immobilized until it gets more (this is tested before each move
  4692. action; note that this does not affect any other action, including
  4693. entering and leaving transports).
  4694. Defaults to @code{0}.
  4695. @end deffn
  4696.  
  4697. @node Entry Action, Research Action, Movement Action, Actions
  4698.  
  4699. @subsection Entry Action
  4700.  
  4701. Units can be inside other units, and have units inside them, in a
  4702. tree-like fashion.  There is no limit on the depth of the tree,
  4703. but most occupant-transport relationships have other limits.
  4704.  
  4705. @deffn ActionType @code{enter} unit
  4706. This is the action to enter the given @var{unit}.
  4707. @end deffn
  4708.  
  4709. @deffn UnitTypeProperty @code{acp-to-enter-unit} acp
  4710. This property is the number of acp a unit uses to do one entry action.
  4711. Defaults to @code{1}.
  4712. @end deffn
  4713.  
  4714. @deffn Table @code{can-enter-independent} u1 u2 -> t/f
  4715. This table is true if a unit @var{u1} can enter an independent unit @var{u2}.
  4716. Defaults to @code{false}.
  4717. @end deffn
  4718.  
  4719. Entering and leaving incur mp costs as does movment,
  4720. but units with a speed of 0 may enter and leave transports.
  4721.  
  4722. @deffn Table @code{mp-to-enter-unit} u1 u2 -> n
  4723. This table is the extra movement points required for @var{u1}
  4724. to enter the transport @var{u2},
  4725. and vice versa (i.e. how much of transport's time is consumed by the process).
  4726. Defaults to @code{0}.
  4727. @end deffn
  4728.  
  4729. @deffn Table @code{mp-to-leave-unit} u1 u2 -> n
  4730. Similar to entry cost.
  4731. Defaults to @code{0}.
  4732. @end deffn
  4733.  
  4734. Note that these mp consumptions need not be symmetrical
  4735. between occupant and transport,
  4736. so for instance a passenger can use 2 of its mp to get on a transport,
  4737. while costing the transport only one of its mp.
  4738.  
  4739. @deffn Table @code{ferry-on-entry} u1 u2 -> ferry-type
  4740. @end deffn
  4741. @deffn Table @code{ferry-on-departure} u1 u2 -> ferry-type
  4742. This table specifies how much intervening terrain the unit @var{u2}
  4743. entering or leaving transport @var{u1}
  4744. will have to cross on its own (and thus incur the terrain's mp costs and
  4745. limitations).
  4746. Defaults to @code{over-border}.
  4747. @end deffn
  4748.  
  4749. @deffn GlobalConstant @code{over-nothing}
  4750. This constant indicates no ferrying,
  4751. occupant must pay all costs to go to destination cell.
  4752. @end deffn
  4753.  
  4754. @deffn GlobalConstant @code{over-own}
  4755. This constant indicates that the transport ferries over terrain
  4756. of its own cell.
  4757. @end deffn
  4758.  
  4759. @deffn GlobalConstant @code{over-border}
  4760. This constant indicates that the transport ferries over any
  4761. border terrain also.
  4762. @end deffn
  4763.  
  4764. @deffn GlobalConstant @code{over-all}
  4765. This constant indicates that the transport ferries to destination cell,
  4766. effectively putting occupant on middle of cell,
  4767. on connection terrain if necessary.
  4768. @end deffn
  4769.  
  4770. @node Research Action, Toolup Action, Entry Action, Actions
  4771.  
  4772. @subsection Research Action
  4773.  
  4774. Research is an action performed by a unit with the sole effect
  4775. of increasing its side's tech level.
  4776. Research cannot be performed by independent units.
  4777.  
  4778. @deffn ActionType @code{research} u
  4779. This is the action of researching the unit type @var{u}.
  4780. If the action is valid, then the tech level of the side
  4781. will increase.
  4782. Unit types with any tech crossover will also have their tech
  4783. levels adjusted.
  4784. @end deffn
  4785.  
  4786. @deffn UnitTypeProperty @code{acp-to-research} acp
  4787. This property is the number of action points used up by one research action.
  4788. Defaults to @code{0}, which disallows research.
  4789. @end deffn
  4790.  
  4791. @deffn Table @code{tech-per-research} u1 u2 -> .01n
  4792. This table is the gain in tech level resulting from a research action, expressed as
  4793. 1/100 of a level.  This value is stochastic.
  4794. Defaults to @code{0}.
  4795. @end deffn
  4796.  
  4797. @deffn UnitTypeProperty @code{tech-per-turn-max} tl
  4798. This property is a ceiling on the total gain of tech level possible in one turn
  4799. for each side and this unit type.
  4800. Defaults to @code{9999}.
  4801. @end deffn
  4802.  
  4803. @node Toolup Action, Unit Creation Actions, Research Action, Actions
  4804.  
  4805. @subsection Toolup Action
  4806.  
  4807. There are several stages in the construction of a unit: tooling up,
  4808. creation, and completion.  Tooling up is where the building unit
  4809. prepares to build, creation is the step where the new unit comes into
  4810. existence, and completion is where the new unit is brought up to being
  4811. operational.
  4812.  
  4813. For the player, this is mostly automatic; if tooling must be
  4814. done first, a user command to build will generate the appropriate actions.
  4815.  
  4816. Once the technology has been achieved, a unit that intends to construct
  4817. other units may need to tool up.
  4818. This is expressed as @dfn{tool points} or @dfn{tp}.
  4819. Tool points start at zero, can be increased by tooling actions,
  4820. and may gradually decline (representing wear and tear on the equipment).
  4821.  
  4822. @deffn ActionType @code{toolup} u
  4823. This is the action of tooling up to build a unit of type @code{u}.
  4824. The result is an increase in the tp for the acting unit.
  4825. @end deffn
  4826.  
  4827. @deffn UnitTypeProperty @code{acp-to-toolup} acp
  4828. This property gives the number of acp needed to do a toolup action.
  4829. Defaults to @code{0}, which disallows tooling up.
  4830. @end deffn
  4831.  
  4832. @deffn Table @code{tp-per-toolup} u1 u2 -> tp
  4833. This table is the number of tp gained by one tooling action.
  4834. Defaults to @code{0}.
  4835. @end deffn
  4836.  
  4837. @deffn Table @code{tp-to-build} u1 u2 -> tp
  4838. This table is the number of toolup points needed before a unit of type @var{u1}
  4839. can create or build a unit of type @var{u2}.
  4840. Defaults to @code{0}.
  4841. @end deffn
  4842.  
  4843. @deffn Table @code{tp-max} u1 u2 -> tp
  4844. This table is the maximum possible tooling.
  4845. Defaults to @code{0}.
  4846. @end deffn
  4847.  
  4848. @deffn Table @code{tp-attrition} u1 u2 -> tp
  4849. This table is the number of .01 tool points automatically lost at
  4850. the end of each turn.
  4851. Defaults to @code{0}.
  4852. @end deffn
  4853.  
  4854. @deffn Table @code{tp-crossover} u1 u2 -> n%
  4855. This table is the number of tool points for @var{u2} that is
  4856. guaranteed to exist, expressed as a percentage of the tool
  4857. points for @var{u1}.
  4858. For instance, if @code{tp-crossover} is 80,
  4859. and a unit's tool points for @var{u1}
  4860. is 10 out of a max of 20, and the max for @var{u2} is also 20,
  4861. then the unit will have tool points for @var{u2} at least 8.
  4862. Defaults to @code{0}.
  4863. @end deffn
  4864.  
  4865. @node Unit Creation Actions, Unit Completion Action, Toolup Action, Actions
  4866.  
  4867. @subsection Unit Creation Actions
  4868.  
  4869. When a constructing unit is tooled up, the build action creates a unit
  4870. immediately and puts it in its designated location, whether inside the
  4871. unit doing the building or somewhere nearby.  This new unit, however, is
  4872. incomplete, representing the keel of the ship or the surveyor's
  4873. lines for an airstrip.  Incomplete units are thus basically skeletons,
  4874. with some unit characteristics, but unable to move or act in any way.
  4875. They also cannot have any occupants, unless the occupants are of a type
  4876. that can complete the unit.  Those occupants do not derive any protection
  4877. or other advantages from occupying the incomplete unit, and they are not
  4878. affected by the @code{occupant-can-build} limitation. 
  4879.  
  4880. @deffn ActionType @code{create-in} u unit
  4881. This action creates a new unit of type @var{u} occupying the given
  4882. unit @var{unit}.
  4883. The unit @var{unit} must have room for the new unit.
  4884. @end deffn
  4885.  
  4886. @deffn ActionType @code{create-at} u x y z
  4887. This action creates a new unit of type @var{u} in the open at
  4888. @var{x,y,z}.
  4889. The cell must have room for this new unit.
  4890. @end deffn
  4891.  
  4892. @deffn Table @code{acp-to-create} u1 u2 -> acp
  4893. This table is the acp used by a unit of type @var{u1}
  4894. to create a a unit of type @var{u2}.
  4895. If zero, then @var{u1} cannot create a @var{u2}.
  4896. Defaults to @code{0}.
  4897. @end deffn
  4898.  
  4899. @deffn Table @code{create-range} u1 u2 -> dist
  4900. This table is the maximum distance at which a unit of type @var{u1}
  4901. can create a unit of type @var{u2}.
  4902. Defaults to @code{0}.
  4903. @end deffn
  4904.  
  4905. @deffn Table @code{cp-on-creation} u1 u2 -> cp
  4906. This table is the completeness of a unit of type @var{u2} when
  4907. created by a unit of type @var{u1}.
  4908. Defaults to @code{1}.
  4909. @end deffn
  4910.  
  4911. @deffn Table @code{material-to-create} u m -> n
  4912. This table is the total amount of a material type @var{m}
  4913. needed to create a unit of type @var{u}.
  4914. Defaults to @code{0}.
  4915. @end deffn
  4916.  
  4917. @deffn Table @code{consumption-on-creation} u m -> n
  4918. This table is the amount of a material type @var{m}
  4919. consumed to create a unit of type @var{u}.
  4920. Defaults to @code{0}.
  4921. @end deffn
  4922.  
  4923. @deffn Table @code{supply-on-creation} u m -> n
  4924. This table is the amount of supply of each material type @var{m}
  4925. to give a newly created unit of type @var{u}.
  4926. This supply is newly generated, does not come from anywhere else.
  4927. (Note that players could cheat by creating units, taking their supply,
  4928. and never completing them.)
  4929. Defaults to @code{0}.
  4930. @end deffn
  4931.  
  4932. @node Unit Completion Action, Repair Action, Unit Creation Actions, Actions
  4933.  
  4934. @subsection Unit Completion Action
  4935.  
  4936. Once an incomplete unit has been created,
  4937. other units can help to complete it.
  4938.  
  4939. @deffn ActionType @code{build} unit
  4940. This action adds to the completeness of @var{unit}.
  4941. If the unit becomes complete, it will be given its initial supply,
  4942. acp, name, etc.
  4943. @end deffn
  4944.  
  4945. @deffn Table @code{acp-to-build} u1 u2 -> acp
  4946. This table is the acp used up by one build action by a unit of type @var{u1}
  4947. when buiding a unit of type @var{u2}.
  4948. Defaults to @code{0}.
  4949. @end deffn
  4950.  
  4951. @deffn Table @code{cp-per-build} u1 u2 -> cp
  4952. This table is the amount of completeness of a unit of type @var{u2}
  4953. added by each completion action performed by a unit of type @var{u1}.
  4954. If @code{0}, then @var{u1} cannot contribute to completing @var{u2}.
  4955. Defaults to @code{1}.
  4956. @end deffn
  4957.  
  4958. @deffn Table @code{material-to-build} u1 m -> n
  4959. This table is the amount of each material type @var{m}
  4960. that @var{u1} must have in order to build anything at all.
  4961. Defaults to @code{0}.
  4962. @end deffn
  4963.  
  4964. @deffn Table @code{consumption-per-build} u2 m -> n
  4965. This table is the total amount of each material type @var{m}
  4966. consumed by the completion of a unit of type @var{u2}.
  4967. To calculate the consumption of a single build action,
  4968. this amount is divided by @var{u2}'s cp and multiplied by the
  4969. number of cp added by the action.  Fractions round up when
  4970. the unit's cp is low, so that the full consumption happens.
  4971. Defaults to @code{0}.
  4972. @end deffn
  4973.  
  4974. @deffn Table @code{build-range} u1 u2 -> dist
  4975. This table is the maximum distance allowed between a unit of type @var{u1}
  4976. and the incomplete unit of type @var{u2} it is working on.
  4977. Defaults to @code{0}, which requires the two units to be in
  4978. the same cell.
  4979. @end deffn
  4980.  
  4981. At a given point, incomplete units can make progress towards
  4982. completion on their own.  This is automatic because incomplete
  4983. units are unable to act, and occurs at a constant specified rate.
  4984. Automatic completion always occurs, even if other units are doing
  4985. build actions at the same time.  The incomplete unit must have
  4986. any necessary supplies.
  4987.  
  4988. @deffn UnitTypeProperty @code{cp-to-self-build} cp
  4989. This property is the minimum completeness of the unit necessary before it
  4990. can work on itself.
  4991. Defaults to @code{0}.
  4992. @end deffn
  4993.  
  4994. @deffn UnitTypeProperty @code{cp-per-self-build} cp
  4995. This property is the completeness added each turn when a unit works on itself.
  4996. Defaults to @code{0}.
  4997. @end deffn
  4998.  
  4999. @deffn Table @code{supply-on-completion} u m -> n
  5000. This table is the minimum amount of supply of each material type @var{m}
  5001. guaranteed to a newly completed unit of type @var{u}.
  5002. If not already available to the unit, it will be newly generated.
  5003. Defaults to @code{0}.
  5004. @end deffn
  5005.  
  5006. @node Repair Action, Material Production Action, Unit Completion Action, Actions
  5007.  
  5008. @subsection Repair Action
  5009.  
  5010. Units can restore their own and each other's hp by doing repairs.
  5011. Repair requires a repair action.
  5012. The action points for this action
  5013. are taken from both the unit being repaired and
  5014. the repairer (using the same table @code{acp-to-repair}).
  5015. When a unit repairs itself, the action cost is counted once only.
  5016.  
  5017. @deffn ActionType @code{repair} unit
  5018. This is the action of repairing the given @var{unit}.
  5019. @end deffn
  5020.  
  5021. @deffn Table @code{acp-to-repair} u1 u2 -> acp
  5022. This table is the number of action points used up
  5023. by a unit of type @var{u1}
  5024. doing one repair action on a unit of type @var{u2}.
  5025. Defaults to @code{0}, which disallows the action.
  5026. @end deffn
  5027.  
  5028. @deffn Table @code{hp-per-repair} u1 u2 -> .01hp
  5029. This table is the hundredths of a hp that a single repair action
  5030. by a unit of type @var{u1} restores to a unit of type @var{u2}.
  5031. The fraction of this over 100 is added to hp directly,
  5032. while the < 100 fraction is added probabilistically.
  5033. (For example, a value of 160 means that 1 hp will be added for
  5034. each action, and there is a 60% chance that a second hp will
  5035. be added also.)
  5036. Defaults to @code{0}.
  5037. @end deffn
  5038.  
  5039. Materials may be needed and/or consumed during repair.
  5040. The materials will be taken from the
  5041. unit being repaired, then from the repairer.
  5042.  
  5043. @deffn Table @code{material-to-repair} u m -> .01n
  5044. This table is the amount of each material type @var{m} needed
  5045. for one repair action.
  5046. As with @code{hp-per-repair},
  5047. the < 100 part is average, and > 100 is guaranteed.
  5048. Defaults to @code{0}.
  5049. @end deffn
  5050.  
  5051. @deffn Table @code{consumption-per-repair} u m -> .01n
  5052. This table is the amount of each material type @var{m}
  5053. used up by a repair action.
  5054. @end deffn
  5055.  
  5056. The repairing unit must also not be too damaged itself to do repairs.
  5057.  
  5058. @deffn Table @code{hp-to-repair} u1 u2 -> hp
  5059. This table is the minimum hp level required of a unit of type @var{u1}
  5060. to repair a unit of type @var{u2}.
  5061. If less, then @var{u1} is too damaged to do any repairing.
  5062. Defaults to @code{1}, which allows repair always.
  5063. @end deffn
  5064.  
  5065. The following are not really part of the repair action definition, since
  5066. they occur automatically, but they share many of the tables above.
  5067.  
  5068. @deffn Table @code{auto-repair} u1 u2 -> .01hp
  5069. This table is the amount of repair (in 1/100 hp) that @var{u1} will do
  5070. on any unit of type @var{u2} within range (@code{auto-repair-range}).
  5071. As with @code{hp-per-repair},
  5072. the < 1.00 part is average, and > 1.00 is guaranteed.
  5073. Material requirements and usage are as for repair actions.
  5074. Defaults to @code{0}, which disallows auto-repair.
  5075. @end deffn
  5076.  
  5077. @deffn Table @code{auto-repair-range} u1 u2 -> dist
  5078. This table is the distance out to which @var{u1} will auto-repair
  5079. any damaged @var{u2}.  A value of @code{0} requires the two units
  5080. to be in the same cell, while a value of @code{-1} means that
  5081. @var{u2} must be either an occupant or transport of @var{u1}.
  5082. Defaults to @code{0}.
  5083. @end deffn
  5084.  
  5085. @node Material Production Action, Material Transfer Action, Repair Action, Actions
  5086.  
  5087. @subsection Material Production Action
  5088.  
  5089. Units can produce materials by explicit action.
  5090.  
  5091. @deffn ActionType @code{produce} m
  5092. This action results in a quantity of material @var{m}
  5093. coming into existence.
  5094. @end deffn
  5095.  
  5096. @deffn Table @code{acp-to-produce} u m -> acp
  5097. This table is the acp used up by one @code{produce} action.
  5098. Defaults to @code{0}.
  5099. @end deffn
  5100.  
  5101. @deffn Table @code{material-per-production} u m -> n
  5102. This table is the amount of material produced by @var{u}
  5103. when acting to produce type @var{m}.
  5104. Defaults to @code{0}.
  5105. @end deffn
  5106.  
  5107. @deffn Table @code{material-to-produce} u m -> .01n
  5108. @end deffn
  5109.  
  5110. @node Material Transfer Action, Side Change Action, Material Production Action, Actions
  5111.  
  5112. @subsection Material Transfer Action
  5113.  
  5114. Although most movement of materials between units happens automatically
  5115. (see backdrop economy description, section ???),
  5116. players can also do it explicitly.
  5117. Players can both take materials from other units, and give a unit's
  5118. materials to others.
  5119.  
  5120. @deffn ActionType @code{transfer} unit m n
  5121. This is the action of transferring supply to the given unit @var{unit}.
  5122. The desired amount is @var{n};  if @var{m} is a valid material type,
  5123. then only that type will be transferred, otherwise the action will
  5124. transfer all types of materials possible.
  5125. The actual transfer amounts may be less than @var{n}.
  5126. @end deffn
  5127.  
  5128. @deffn Table @code{acp-to-unload} u1 m -> acp
  5129. @end deffn
  5130. @deffn Table @code{acp-to-load} u1 m -> acp
  5131. These tables are the number of action points used up by one material transfer
  5132. action from @var{u1} to @var{u2}.
  5133. The amount is independent of the material type being transferred.
  5134. If either value is @code{0}, then the material cannot be transferred.
  5135. Defaults to @code{0}.
  5136. @end deffn
  5137.  
  5138. @deffn Table @code{unload-max} u1 m -> n
  5139. @end deffn
  5140. @deffn Table @code{load-max} u2 m -> n
  5141. These two tables determine how much of material @var{m} can be transferred out
  5142. of a unit of type @var{u1} and into one of type @var{u2}
  5143. in one transfer action.
  5144. The actual quantity transferred by the action
  5145. is the minimum of these two values.
  5146. A value of @code{0} disallows manual transfer.
  5147. Both default to @code{-1}, which allows any amount to be transferred.
  5148. @end deffn
  5149.  
  5150. @node Side Change Action, Disband Action, Material Transfer Action, Actions
  5151.  
  5152. @subsection Side Change Action
  5153.  
  5154. @deffn ActionType @code{change-side} side
  5155. This is the action of changing the unit's side to @var{side}.
  5156. The @var{side} can be any allowable side, and the unit
  5157. may be any unit controlled by the actor's side.
  5158. @end deffn
  5159.  
  5160. @deffn UnitTypeProperty @code{acp-to-change-side} acp
  5161. If the value of this property is greater than 0,
  5162. then this type of unit can be ordered to change to another given side.
  5163. If the unit is not a type that can act, then the side change happens
  5164. immediately, instead of as an action, and no acp cost is incurred.
  5165. The type must also be allowed to be on the new side.
  5166. Defaults to @code{0}.
  5167. @end deffn
  5168.  
  5169. @node Disband Action, Part Transfer Action, Side Change Action, Actions
  5170.  
  5171. @subsection Disband Action
  5172.  
  5173. Disbanding is the voluntary and controlled destruction of a unit,
  5174. performed by the unit itself or another unit.
  5175. A disbanded unit always vanishes, rather than changing to its
  5176. @code{wrecked-type}.
  5177.  
  5178. @deffn ActionType @code{disband} unit
  5179. This is the action of removing hp from @var{unit}.
  5180. The unit will vanish if all its hit points are gone.
  5181. @end deffn
  5182.  
  5183. @deffn UnitTypeProperty @code{acp-to-disband} acp
  5184. If the value of this property is greater than 0,
  5185. then this is the acp that will be used up to do one disband action.
  5186. If the unit is not a type that can act, then the disband happens
  5187. immediately, instead of as an action, and no acp cost is incurred.
  5188. Defaults to @code{0}.
  5189. @end deffn
  5190.  
  5191. @deffn UnitTypeProperty @code{hp-per-disband} hp
  5192. This table is the number of hp lost in a disband action.
  5193. Defaults to @code{0}, which disallows disbanding.
  5194. @end deffn
  5195.  
  5196. A disbanded unit can be scavenged for materials.
  5197.  
  5198. @deffn Table @code{supply-per-disband} u m -> n%
  5199. This table is the percentage of the unit's supply that is recovered
  5200. from a single disband action.
  5201. If the value is zero, then the unit's supply will not be
  5202. recovered by the disbanding process, and be lost permanently.
  5203. If any supply remains when the unit's hp is 0, then that
  5204. supply will be lost also.
  5205. Defaults to @code{100}, which means that the entire supply
  5206. will be recovered on the first disband action.
  5207. @end deffn
  5208.  
  5209. Note that if an essential supply is 100% recovered before the unit
  5210. is completely disbanded, then it may die from starvation first.
  5211. A partly-disbanded unit may still acquire supply
  5212. from nearby units, via the backdrop economy.
  5213.  
  5214. @deffn Table @code{recycleable-material} u m -> n
  5215. This table is the quantity of each type of material that becomes available
  5216. when a unit is completely disbanded.
  5217. The materials go to transports, occupants, and nearby units, in that order.
  5218. Any materials exceeding capacities of these units will be discarded.
  5219. These materials become available only when the unit vanishes.
  5220. Defaults to @code{0}.
  5221. @end deffn
  5222.  
  5223. @node Part Transfer Action, Type Change Action, Disband Action, Actions
  5224.  
  5225. @subsection Part Transfer Action
  5226.  
  5227. Units of variable size can transfer parts of themselves to other
  5228. units, or create a new unit.
  5229.  
  5230. @deffn ActionType @code{transfer-part} n unit
  5231. This action moves @var{n} parts of the actee to @var{unit},
  5232. or creates a new unit if @var{unit} is omitted.
  5233. If @var{n} is negative, this takes from @var{unit} instead.
  5234. If the action takes all the parts of any involved unit,
  5235. then it vanishes.
  5236. @end deffn
  5237.  
  5238. @deffn UnitTypeProperty @code{acp-to-transfer-part} acp
  5239. This property is the number of acp used up by the unit
  5240. when doing a part transfer action.
  5241. If 0, then part transfer is not allowed.
  5242. Defaults to @code{0}.
  5243. @end deffn
  5244.  
  5245. @node Type Change Action, Combat Actions, Part Transfer Action, Actions
  5246.  
  5247. @subsection Type Change Action
  5248.  
  5249. Units may change their type.
  5250.  
  5251. @deffn ActionType @code{change-type} u
  5252. This action changes the type of the actee unit to the type @var{u}.
  5253. Upon changing, the relationships of the unit with the world and
  5254. with other units will be recalculated; occupants that can no longer
  5255. stay in the unit will be ejected or disappear.  The unit itself
  5256. may vanish or wreck, if it is in the open on a terrain type that will
  5257. cause units of the new type to vanish or wreck.
  5258. @end deffn
  5259.  
  5260. @deffn Table @code{acp-to-change-type} u1 u2 -> acp
  5261. This table is the number of acp needed to change a unit of
  5262. type @var{u1} into a unit of type @var{u2}.
  5263. If the value is 0, then the change is never possible.
  5264. Defaults to @code{0}.
  5265. @end deffn
  5266.  
  5267. @deffn Table @code{material-to-change-type} u m -> n
  5268. This is the amount of each material type @var{m} required for a unit
  5269. to change into a unit of type @var{u}.
  5270. Defaults to @code{0}.
  5271. @end deffn
  5272.  
  5273. @node Combat Actions, Capture Action, Type Change Action, Actions
  5274.  
  5275. @subsection Combat Actions
  5276.  
  5277. @i{Xconq} combat is somewhat abstract; the attacking player decides what sort
  5278. of attack to mount and perhaps when to retreat, but all else happens
  5279. automatically.
  5280.  
  5281. Combat may last longer than a single action;
  5282. it is then called a @dfn{battle} and divided into @dfn{rounds}.
  5283. The battle exists until one participant has a commitment of zero.
  5284. Units in a battle need not attack, and no damage will occur if none do so,
  5285. but they cannot move away until no longer committed.
  5286.  
  5287. The attacker/defender distinction applies only to a single action.
  5288.  
  5289. @deffn ActionType @code{attack} unit commit
  5290. This action is a direct attack on the given @var{unit},
  5291. at a commitment level of @var{commit}.
  5292. The @var{unit} must be known to the attacking unit's side.
  5293. @end deffn
  5294.  
  5295. @deffn ActionType @code{overrun} x y z commit
  5296. This action is a combined attack/capture/move action.
  5297. The basic theory of an overrun is that the actor will attack,
  5298. capture, or co-occupy the cell at @var{x,y}, elevation @code{z},
  5299. with a commitment of @var{commit}.
  5300. The exact effects depend on the types and sides of units in the destination.
  5301. @end deffn
  5302.  
  5303. @deffn Table @code{acp-to-attack} u1 u2 -> acp
  5304. This table is the number of action points used up by a unit @var{u1}
  5305. when attacking a unit of type @var{u2}.
  5306. If the value is 0, attack is not allowed.
  5307. Defaults to @code{1}.
  5308. @end deffn
  5309.  
  5310. @deffn Table @code{acp-to-defend} u1 u2 -> acp
  5311. This table is the number of action points used up by a unit @var{u1}
  5312. when defending against an attack by a unit of type @var{u2}.
  5313. If the value is 0, attack is not allowed.
  5314. Defaults to @code{1}.
  5315. @end deffn
  5316.  
  5317. @deffn Table @code{attack-range-min} u1 u2 -> dist
  5318. This table is the minimum distance at which a unit can attack another.
  5319. A value of 0 means that units in the same cell can fight.
  5320. Defaults to @code{0}.
  5321. @end deffn
  5322.  
  5323. @deffn Table @code{attack-range} u1 u2 -> dist
  5324. This table is the maximum distance at which a unit can attack another.
  5325. A value of 1 means that units in adjacent cells may fight, while a
  5326. value of 0 means that only units in the same cell may fight.
  5327. Defaults to @code{1}.
  5328. @end deffn
  5329.  
  5330. One round of combat consists of an attack, a reaction,
  5331. and a calculation of effects.
  5332.  
  5333. The defender's reaction is completely automatic, and occurs as part of the
  5334. combat round.  The defender's side does not get a chance to
  5335. decide what to do until the next round,
  5336. although doctrine may constrain the set of reactions.
  5337.  
  5338. @deffn Table @code{surrender-chance-per-attack} u1 u2 -> n%
  5339. This table is the chance that @var{u2} will surrender to @var{u1}
  5340. immediately upon being attacked.
  5341. Defaults to @code{0}.
  5342. @end deffn
  5343.  
  5344. @deffn Table @code{withdraw-chance-per-attack} u1 u2 -> n%
  5345. This table is the chance that @var{u2} will retreat from @var{u1}
  5346. immediately upon being attacked.
  5347. Defaults to @code{0}.
  5348. @end deffn
  5349.  
  5350. @deffn Table @code{acp-for-retreat} u1 u2 -> acp
  5351. This table is the extra acp that @var{u2} can get in order
  5352. to make a withdrawal possible.
  5353. Defaults to @code{0}.
  5354. @end deffn
  5355.  
  5356. @deffn Table @code{counterattack} u1 u2 -> n
  5357. This table is the strength of a defender's reaction to an attack.
  5358. If 0, the defender does not counterattack;
  5359. if 100, the defender counterattacks at the same level as
  5360. if it attacked normally.
  5361. Defaults to @code{100}.
  5362. @end deffn
  5363.  
  5364. In an overrun action,
  5365. if all the defending units are destroyed,
  5366. the attacker has sufficient acp and mp,
  5367. and the destination is safe to enter,
  5368. then the attacker can move into the defenders' cell.
  5369.  
  5370. Firing is a kind of attack that can take place at a distance,
  5371. involves no commitment or counterattack,
  5372. and for which the type of ammo may be selected.
  5373.  
  5374. @deffn ActionType @code{fire-at} unit m
  5375. This is the action of firing at a given @var{unit}.
  5376. If @var{m} is a valid material type, then that type will be used as ammo,
  5377. otherwise all available types will be used together.
  5378. @end deffn
  5379.  
  5380. @deffn ActionType @code{fire-into} x y z m
  5381. This is the action of firing into the cell at @var{x,y}.
  5382. If @var{z} is a valid altitude, then the fire will be concentrated
  5383. on units at that elevation.
  5384. If @var{m} is a valid material type, then that type will be used as ammo,
  5385. otherwise all available types will be used together.
  5386. @end deffn
  5387.  
  5388. @deffn UnitTypeProperty @code{acp-to-fire} acp
  5389. If this property is greater than 0, this type may attack by firing.
  5390. Defaults to @code{0}.
  5391. @end deffn
  5392.  
  5393. @deffn Table @code{acp-to-be-fired-on} u1 u2 -> acp
  5394. This table is the acp lost when a unit is being fired upon.
  5395. Defaults to @code{1}.
  5396. @end deffn
  5397.  
  5398. @deffn UnitTypeProperty @code{range} dist
  5399. This property is the maximum distance to which a unit can fire.
  5400. Defaults to @code{1}.
  5401. @end deffn
  5402.  
  5403. @deffn UnitTypeProperty @code{range-min} dist
  5404. This property is the minimum distance to which a unit can fire.
  5405. Defaults to @code{0}.
  5406. @end deffn
  5407.  
  5408. Both attack and fire combat calculate hits and damage in
  5409. a similar way, although they may use different tables.
  5410.  
  5411. @deffn Table @code{hit-chance} u1 u2 -> n%
  5412. This table is the basic chance that a unit of type @var{u1} will
  5413. actually hit a unit of type @var{u2}.
  5414. If the hit chance is @code{0}, then the unit may never attack
  5415. a unit of that type.
  5416. Defaults to @code{0}.
  5417. @end deffn
  5418.  
  5419. @deffn Table @code{fire-hit-chance} u1 u2 -> n%
  5420. This table is the basic chance that fire from a unit of type @var{u1} will
  5421. actually hit a unit of type @var{u2}.
  5422. If the hit chance is @code{0}, then the unit may never
  5423. fire at a unit of that type.
  5424. If the value is @code{-1}, then the value of this is the same
  5425. as the value of @code{hit-chance}.
  5426. Defaults to @code{-1}.
  5427. @end deffn
  5428.  
  5429. @deffn Table @code{attack-terrain-effect} u1 t -> n%
  5430. @end deffn
  5431. @deffn Table @code{defend-terrain-effect} u2 t -> n%
  5432. @end deffn
  5433. @deffn Table @code{fire-attack-terrain-effect} u1 t -> n%
  5434. @end deffn
  5435. @deffn Table @code{fire-defend-terrain-effect} u2 t -> n%
  5436. These tables specify the
  5437. effect of attacker's and defender's respective terrains on
  5438. @code{hit-chance} or @code{fire-hit-chance}.
  5439. These chances are multiplied with the basic hit chance.
  5440. Default to @code{100}.
  5441. @end deffn
  5442.  
  5443. @deffn Table @code{hit-cxp-effect} u1 u2 -> n
  5444. This table is the effect of combat experience on hit chance.
  5445. Its value is interpolated according to actual experience
  5446. (@var{n} is the effect when @var{u1} is at its maximum
  5447. possible experience), then multiplied with the hit chance.
  5448. Defaults to @code{100}.
  5449. @end deffn
  5450.  
  5451. The effectiveness of fire may be less at long ranges.  If the
  5452. range to the target is greater than @code{hit-falloff-range},
  5453. the chance of hitting it will be reduced by the interpolation
  5454. between the short-range chance and that chance multiplied by
  5455. the value of @code{hit-at-max-range-effect}.  For example, if
  5456. a unit's range is 4, its hit falloff range is 1,
  5457. the basic hit chance is 60%, and the max range effect is 50%,
  5458. then its hit chance at range 2 is 50%, at range 3 is 40%, and
  5459. at range 4 is 30%.
  5460.  
  5461. @deffn Table @code{hit-falloff-range} u1 u2 -> n
  5462. This table is the maximum range at which the effectiveness of combat
  5463. is @i{not} affected by distance.
  5464. Defaults to @code{1}.
  5465. @end deffn
  5466.  
  5467. @deffn Table @code{hit-at-max-range-effect} u1 u2 -> n%
  5468. This is the multiplier for the effectiveness of firing at the
  5469. maximum range possible.
  5470. Defaults to @code{100}.
  5471. @end deffn
  5472.  
  5473. @deffn Table @code{damage} u1 u2 -> hp
  5474. This table is the basic amount of damage caused by a successful attack.
  5475. The value is a dice spec.
  5476. Defaults to @code{1}.
  5477. @end deffn
  5478.  
  5479. @deffn Table @code{fire-damage} u1 u2 -> hp
  5480. This table is the basic amount of damage caused by a successful firing.
  5481. The value is a dice spec.
  5482. If the value is @code{-1}, then it is the same as @code{damage}.
  5483. Defaults to @code{-1}.
  5484. @end deffn
  5485.  
  5486. Damage done by combat is always prorated by commitment;
  5487. the table values are for attacks at full commitment.
  5488.  
  5489. @deffn Table @code{damage-cxp-effect} u1 u2 -> n
  5490. This table is the effect of combat experience on damage.
  5491. Its value is interpolated according to actual experience
  5492. (so that @var{n} is the effect when @var{u1} is at its maximum
  5493. experience), then multiplied with both the dice size and the
  5494. addend of the damage spec.
  5495. Defaults to @code{100}.
  5496. @end deffn
  5497.  
  5498. @deffn Table @code{hp-min} u1 u2 -> hp
  5499. This table is the lowest hp possible for @var{u1} from attacks by @var{u2}.
  5500. Further attacks by @var{u2} are still valid, but can do no further damage.
  5501. Defaults to @code{0}.
  5502. @end deffn
  5503.  
  5504. You can set a unit to use a material as ammo.
  5505.  
  5506. @deffn Table @code{consumption-per-attack} u1 m -> n
  5507. @end deffn
  5508. @deffn Table @code{hit-by} u2 m -> n
  5509. These tables specify material consumption in combat.
  5510. For each material @code{m}, the min of these two values is the amount
  5511. of u1's supply used up in an attack on u2.
  5512. Both default to @code{0}.
  5513. @end deffn
  5514.  
  5515. @deffn Table @code{material-to-fight} u m -> n
  5516. This table is a minimum of each material type @var{m} that a unit must
  5517. have to engage in any sort of combat.
  5518. This minimum is not necessarily used up in combat, it just needs to
  5519. be present.
  5520. Defaults to @code{0}.
  5521. @end deffn
  5522.  
  5523. Transports can protect their occupants, and vice versa.
  5524.  
  5525. @deffn Table @code{protection} u1 u2 -> n%
  5526. This table gives the effect of occupants of type @var{u1} on the chance
  5527. of another unit's attack hitting their transport @var{u2},
  5528. as well as the effect of the transport @var{u1} on the chance that
  5529. occupants of type @var{u2} will be hit.
  5530. This is a multiplier, where 100 has no protection, values less than
  5531. 100 decrease hit chance, and values greater than 100 increase it.
  5532. Each occupant will be taken into account when computing transport's
  5533. protection.
  5534. Defaults to @code{100}.
  5535. @end deffn
  5536.  
  5537. A transport's destruction may leave occupants stranded on hex,
  5538. will do some sort of auto-escape or die if terrain is hostile.
  5539.  
  5540. Units stacked together can protect each other.
  5541.  
  5542. @deffn Table @code{stack-protection} u1 u2 -> n%
  5543. This table is the effect of units of type @var{u1} on attacks
  5544. on units of type @var{u2} that are in the same cell.
  5545. The effect is similar to that described for the @code{protection}
  5546. table.
  5547. Defaults to @code{100}.
  5548. @end deffn
  5549.  
  5550. Several other side-effects of combat may also be defined.
  5551.  
  5552. Units can retreat if they are about to be damaged; the retreat attempt
  5553. is automatic, and will be in a valid direction that is away from the attacker.
  5554. The retreat attempt will fail if there is no direction that the unit may
  5555. move, or if has insufficient materials, acp, etc to do the movement.
  5556. If the attempt is successful, then the unit will not be damaged;
  5557. otherwise it must take the hit.
  5558.  
  5559. @deffn Table @code{retreat-chance} u1 u2 -> n%
  5560. This table is the chance that @var{u2} will attempt to retreat
  5561. if it is hit by @var{u1}.
  5562. Defaults to @code{0}.
  5563. @end deffn
  5564.  
  5565. @deffn Table @code{cxp-per-combat} u1 u2 -> cxp
  5566. This table is the number of combat experience points gained by @var{u1} 
  5567. by surviving a combat round with @var{u2}.
  5568. Both attackers and defenders gain experience equally.
  5569. Defaults to @code{0}.
  5570. @end deffn
  5571.  
  5572. @node Capture Action, Detonation Action, Combat Actions, Actions
  5573.  
  5574. @subsection Capture Action
  5575.  
  5576. A unit may attempt to capture another unit directly.
  5577. If successful, the captured unit's side changes to that of the capturing unit.
  5578.  
  5579. @deffn ActionType @code{capture} unit
  5580. This is the action of capturing the given @var{unit}.
  5581. @end deffn
  5582.  
  5583. @deffn Table @code{acp-to-capture} u1 u2 -> acp
  5584. This table is the number of acp used up by a @code{capture} action.
  5585. Defaults to @code{0}, which disallows capture.
  5586. @end deffn
  5587.  
  5588. @deffn Table @code{bridge} u1 u2 -> t/f
  5589. This table is true if a unit of type @var{u1} can be captured by a unit of
  5590. type @var{u2} even if @var{u1} is on a type of terrain impassable to
  5591. the capturing unit.
  5592. Defaults to @code{false}. 
  5593. @end deffn
  5594.  
  5595. @deffn Table @code{capture-chance} u1 u2 -> n%
  5596. This table is the basic chance for @var{u1} to capture @var{u2}.
  5597. Defaults to @code{0}.
  5598. @end deffn
  5599.  
  5600. @deffn Table @code{independent-capture-chance} u1 u2 -> n%
  5601. This table is the basic chance for @var{u1} to capture an independent unit 
  5602. of type @var{u2}.  If the value is @code{-1}, then the chance of capture
  5603. is given by the @code{capture-chance}.
  5604. Defaults to @code{-1}.
  5605. @end deffn
  5606.  
  5607. @deffn Table @code{scuttle-chance} u t -> n%
  5608. This table is the chance that a unit whose capture is guaranteed will destroy
  5609. itself instead.  Scuttling is destructive, so unit changes to @code{wrecked-type}.
  5610. Occupants of an about-to-be-captured unit will also attempt to scuttle.
  5611. Defaults to @code{0}.
  5612. @end deffn
  5613.  
  5614. @deffn Table @code{occupant-escape-chance} u1 u2 -> n%
  5615. This table is the chance that an occupant @var{u1} will escape during the capture
  5616. of a unit of type @var{u2}.
  5617. Occupants that do not escape are either captured themselves or destroyed,
  5618. depending on their type and the capturing unit's side.
  5619. Defaults to @code{0}.
  5620. @end deffn
  5621.  
  5622. @deffn Table @code{hp-to-garrison} u1 u2 -> n
  5623. This table is the number of hp that will be taken from the capturing
  5624. unit @var{u1} in order to guard a captured @var{u2}.
  5625. If the amount is the unit's full hp, then the unit will vanish
  5626. and any occupants will be distributed to the captured unit, to open
  5627. terrain, or will vanish themselves if there is no other option.
  5628. Defaults to @code{0}.
  5629. @end deffn
  5630.  
  5631. @deffn Table @code{countercapture} u1 u2 -> n
  5632. This table defines the defending unit's reaction to the capture
  5633. attempt.
  5634. If 0, then the unit does not react to the capture attempt.
  5635. Defaults to @code{0}.
  5636. @end deffn
  5637.  
  5638. Captures can also affect combat experience, but has different effects
  5639. on the capturing and captured units.
  5640.  
  5641. @deffn Table @code{cxp-per-capture} u1 u2 -> cxp
  5642. This table is the number of combat experience points gained by @var{u1} 
  5643. for capturing @var{u2}.
  5644. Defaults to @code{0}.
  5645. @end deffn
  5646.  
  5647. @deffn UnitTypeProperty @code{cxp-on-capture-effect} n
  5648. This property gives the change in a unit's cxp due to being captured,
  5649. expressed as a multiplier.
  5650. Defaults to @code{100}.
  5651. @end deffn
  5652.  
  5653. @node Detonation Action, Terrain Alteration Actions, Capture Action, Actions
  5654.  
  5655. @subsection Detonation Action
  5656.  
  5657. Detonation is an action and/or behavior that causes damage indiscriminately.
  5658. The action specifies the location of the detonation,
  5659. which may be in the unit's cell or an adjacent one.
  5660. A unit that detonates loses hp, changing to its @code{wrecked-type}
  5661. if it loses all of its hp.
  5662. It also hits every unit within a specified radius.
  5663. Detonation may also affect terrain within a specified radius.
  5664.  
  5665. @deffn ActionType @code{detonate} x y z
  5666. This action detonates the actee at the given location @var{x,y,z}.
  5667. @end deffn
  5668.  
  5669. @deffn UnitTypeProperty @code{acp-to-detonate} acp
  5670. This property is the number of action points used by one detonate action.
  5671. Defaults to @code{0}, which disallows detonation.
  5672. @end deffn
  5673.  
  5674. @deffn UnitTypeProperty @code{hp-per-detonation} hp
  5675. This property is the number of hp lost in each detonation.
  5676. Defaults to @code{0}.
  5677. @end deffn
  5678.  
  5679. @deffn Table @code{detonation-unit-range} u1 u2 -> dist
  5680. This table gives the range of effect from detonation of @var{u1}.
  5681. The severity falls off according to the inverse square law
  5682. extrapolated from the adjacent cell damage.
  5683. (1/4 severity at range 2, 1/9 at 3, etc.)
  5684. Defaults to @code{0}.
  5685. @end deffn
  5686.  
  5687. @deffn Table @code{detonation-damage-at} u1 u2 -> hp
  5688. This table is the severity of @var{u1}'s hit on a unit @var{u2} in the same cell.
  5689. Defaults to @code{0}.
  5690. @end deffn
  5691.  
  5692. @deffn Table @code{detonation-damage-adjacent} u1 u2 -> hp
  5693. This table is the severity of @var{u1}'s hit on a unit @var{u2} in an adjacent cell.
  5694. Defaults to @code{0}.
  5695. @end deffn
  5696.  
  5697. @deffn Table @code{detonation-terrain-range} u t -> dist
  5698. Defaults to @code{0}.
  5699. @end deffn
  5700.  
  5701. @deffn Table @code{detonation-terrain-damage-chance} u t -> n%
  5702. Defaults to @code{0}.
  5703. @end deffn
  5704.  
  5705. @deffn Table @code{terrain-damaged-type} t1 t2 -> n
  5706. Relative chance that terrain of type @var{t1} damaged by a detonation
  5707. will change into another type @var{t2}.
  5708. Defaults to @code{0}.
  5709. @end deffn
  5710.  
  5711. The following tables and properties can be used for units that cannot
  5712. detonate deliberately by doing a detonate action.
  5713.  
  5714. @deffn Table @code{detonate-on-hit} u1 u2 -> n%
  5715. This table is the chance that a hit on @var{u1}
  5716. by a unit of type @var{u2} will cause it to detonate (once).
  5717. Noncombat reductions in hp, such as attrition, have no effect.
  5718. Defaults to @code{0}.
  5719. @end deffn
  5720.  
  5721. @deffn UnitTypeProperty @code{detonate-on-death} n%
  5722. This property is the chance that if this type is about to die from a combat hit,
  5723. it will detonate first.
  5724. Defaults to @code{0}.
  5725. @end deffn
  5726.  
  5727. @deffn Table @code{detonate-on-capture} u1 u2 -> n%
  5728. This table is the chance that a unit of type @var{u1} will detonate if a capture
  5729. by a unit of type @var{u2} is about to succeed.
  5730. Defaults to @code{0}.
  5731. @end deffn
  5732.  
  5733. @deffn Table @code{detonate-on-approach-range} u1 u2 -> dist
  5734. When a unit of type @var{u2} on a non-trusted [?] side
  5735. appears at a distance of @var{dist}
  5736. or less, then @var{u1} will detonate.
  5737. If @code{-1}, then unit will not detonate upon approach.
  5738. Defaults to @code{-1}.
  5739. @end deffn
  5740.  
  5741. @deffn Table @code{detonation-accident-chance} u t -> n.f%
  5742. This table is the chance that the unit will detonate spontaneously.
  5743. This is checked once/turn, at the beginning of the turn, and also
  5744. upon each entry to a cell, if moving.
  5745. Defaults to @code{0}.
  5746. @end deffn
  5747.  
  5748. @node Terrain Alteration Actions,  , Detonation Action, Actions
  5749.  
  5750. @subsection Terrain Alteration Actions
  5751.  
  5752. @deffn ActionType @code{alter-terrain} x y t
  5753. This action changes the type of the cell at @var{x,y} to @var{t}.
  5754. @end deffn
  5755.  
  5756. @deffn ActionType @code{add-terrain} x y dir t
  5757. This action adds a connection or border of type @var{t}
  5758. to the cell at @var{x,y}, in direction @var{dir}.
  5759. @end deffn
  5760.  
  5761. @deffn ActionType @code{remove-terrain} x y dir t
  5762. This action removes a connection or border of type @var{t}
  5763. to the cell at @var{x,y}, in direction @var{dir}.
  5764. @end deffn
  5765.  
  5766. @deffn Table @code{acp-to-add-terrain} u t -> n
  5767. @end deffn
  5768. @deffn Table @code{acp-to-remove-terrain} u t -> n
  5769. For auxiliary terrain types, these tables are the costs to add or remove.
  5770. For cell terrain, the costs of removing the old type and adding the
  5771. new type are added together.
  5772. If the value is 0, then that type of terrain may not be added
  5773. or removed.  As a special exception, cell terrain may have a cost to
  5774. remove of 0, so that the sum of add and remove costs can be as low as 1;
  5775. in that case, a value of -1 disallows removal.
  5776. Both default to @code{0}.
  5777. @end deffn
  5778.  
  5779. @deffn Table @code{alter-terrain-range} u t -> n
  5780. This table is the maximum distance at which a unit can alter terrain @var{t}.
  5781. Defaults to @code{0}, which means that the unit can change only the
  5782. terrain in its own cell.
  5783. @end deffn
  5784.  
  5785. Note that if @code{see-terrain-always} is false, then other sides will not
  5786. see the terrain change unless they are viewing the altered terrain.
  5787.  
  5788. @node Backdrop Environment Parameters, Backdrop Economy Parameters, Actions, Reference Manual
  5789.  
  5790. @section Backdrop Environment Parameters
  5791.  
  5792. This section describes how to set up backdrop computations affecting the environment.
  5793.  
  5794. @menu
  5795. * Years and Days::              
  5796. * Temperature Variation::           
  5797. * Temperature Effects::           
  5798. * Wind Variation::           
  5799. @end menu
  5800.  
  5801. @node Years and Days, Temperature Variation, Backdrop Environment Parameters, Backdrop Environment Parameters
  5802.  
  5803. @subsection Years and Days
  5804.  
  5805. Cyclic changes in the environment are governed by a yearly cycle
  5806. or a daily cycle whose length must be defined.
  5807.  
  5808. @deffn WorldProperty @code{year-length} n
  5809. This property is the number of turns in an annual cycle.
  5810. If less than @code{2}, then no seasonal effects will be calculated.
  5811. Defaults to @code{0}.
  5812. @end deffn
  5813.  
  5814. @deffn WorldProperty @code{day-length} n
  5815. This property is the number of turns in a single day.
  5816. If less than @code{2}, then day and night will not be calculated.
  5817. Defaults to @code{0}.
  5818. @end deffn
  5819.  
  5820. Note that @code{year-length} and @code{day-length} are
  5821. completely independent of each other, and it is possible
  5822. to have days that are longer than years.
  5823.  
  5824. @deffn AreaProperty @code{initial-year-part} n
  5825. This property is the season of the first turn in the game.
  5826. Defaults to @code{0}.
  5827. @end deffn
  5828.  
  5829. @deffn AreaProperty @code{initial-day-part} n
  5830. This property is the hour of the first turn in the game,
  5831. in 100ths of a day part.
  5832. Defaults to @code{0}.
  5833. @end deffn
  5834.  
  5835. @deffn GlobalVariable @code{season-names} list
  5836. This global is a list of which turns in a year should be called
  5837. which seasons.  It has the form @code{(... (n1 n2 name) ...)}.
  5838. Defaults to @code{()}.
  5839. @end deffn
  5840.  
  5841. @deffn UnitTypeProperty @code{acp-season-effect} interpolation-list
  5842. This property is the effect of the seasons on acp.
  5843. The input value is the year part, and the result value
  5844. is added to the basic @code{acp-per-turn}.
  5845. Defaults to @code{()}.
  5846. @end deffn
  5847.  
  5848. @node Temperature Variation, Temperature Effects, Years and Days, Backdrop Environment Parameters
  5849.  
  5850. @subsection Temperature Variation
  5851.  
  5852. @deffn TerrainTypeProperty @code{temperature-average} n
  5853. This property is the average temperature for each type of terrain.
  5854. Defaults to @code{0}.
  5855. @end deffn
  5856.  
  5857. @deffn TerrainTypeProperty @code{temperature-variability} n
  5858. This property is the amount of totally random variation
  5859. in the temperature in each cell.
  5860. Defaults to @code{0}.
  5861. @end deffn
  5862.  
  5863. @deffn GlobalVariable @code{temperature-year-cycle} ((x y) interpolation-list)@dots{}
  5864. This global is a list of interpolation lists used to set basic temperatures
  5865. at given points in the area.  The input value for each list is the current year
  5866. part, while the result is the temperature at @var{x},@var{y}.
  5867. Then for each point in the area, its temperature is the interpolation of the
  5868. temperature at the two nearest given points.
  5869. Defaults to @code{()}.
  5870. @end deffn
  5871.  
  5872. @deffn TerrainTypeProperty @code{temperature-moderation-range} distance
  5873. This property is the radius of the area whose raw temperatures will be averaged
  5874. to get the actual temperature.
  5875. This can be very time-consuming to calculate,
  5876. so only values of 0 (no averaging)
  5877. and 1 (average with adjacent cells) are recommended.
  5878. Defaults to @code{0}.
  5879. @end deffn
  5880.  
  5881. @node Temperature Effects, Wind Variation, Temperature Variation, Backdrop Environment Parameters
  5882.  
  5883. @subsection Temperature Effects
  5884.  
  5885. @deffn UnitTypeProperty @code{acp-temperature-effect} interpolation-list
  5886. This property is the effect of temperature on acp.
  5887. The input value is temperature, and the result value
  5888. is multiplied with acp, after it has been modified for
  5889. night effect, but before modification for season.
  5890. The result is divided by 100, so an effect < 100 reduces acp, an effect
  5891. of 100 has no effect, and an effect > 100 increases acp.
  5892. Defaults to @code{()}.
  5893. @end deffn
  5894.  
  5895. @deffn UnitTypeProperty @code{consumption-temperature-effect} interpolation-list
  5896. This property is the effect of temperature on material consumption.
  5897. Defaults to @code{()}.
  5898. @end deffn
  5899.  
  5900. @deffn UnitTypeProperty @code{temperature-attrition} interpolation-list
  5901. This property is the effect of temperature on a unit's hp.
  5902. The input value is temperature, and the result value is the
  5903. number of hp that the unit will lose each turn at that temperature.
  5904. Defaults to @code{()}.
  5905. @end deffn
  5906.  
  5907. Transports can protect their occupants from temperature extremes.
  5908.  
  5909. @deffn Table @code{temperature-protection} u1 u2 -> t/f
  5910. @end deffn
  5911.  
  5912. @node Wind Variation, , Temperature Effects, Backdrop Environment Parameters
  5913.  
  5914. @subsection Wind Variation
  5915.  
  5916. @deffn TerrainTypeProperty @code{wind-force-average} n
  5917. This property is the average wind force in a type of terrain.
  5918. Defaults to @code{0}.
  5919. @end deffn
  5920.  
  5921. @deffn TerrainTypeProperty @code{wind-force-variability} n%
  5922. This property is the chance that the wind in a cell will increase
  5923. or decrease in force each turn.
  5924. Defaults to @code{0}.
  5925. @end deffn
  5926.  
  5927. @deffn TerrainTypeProperty @code{wind-variability} n%
  5928. This property is the chance that the wind in a cell will
  5929. change direction each turn.
  5930. Defaults to @code{0}.
  5931. @end deffn
  5932.  
  5933. @deffn GlobalVariable @code{wind-mix-range} n
  5934. This variable is the radius out to which winds interact.
  5935. If 0, then winds in adjacent cells can vary independently
  5936. of each other, and do not interact in any way.
  5937. Defaults to @code{0}.
  5938. @end deffn
  5939.  
  5940. @node Backdrop Economy Parameters, Random Events, Backdrop Environment Parameters, Reference Manual
  5941.  
  5942. @section Backdrop Economy Parameters
  5943.  
  5944. The following parameters control the automatic production, distribution, and
  5945. consumption of materials by units and by cells.
  5946.  
  5947. @menu
  5948. * Unit Production and Consumption::  
  5949. * Terrain Production and Consumption::  
  5950. * Supply Lines::                
  5951. @end menu
  5952.  
  5953. @node Unit Production and Consumption, Terrain Production and Consumption, , Backdrop Economy Parameters
  5954.  
  5955. @subsection Unit Production and Consumption
  5956.  
  5957. Units can be set to always produce some amount of material without
  5958. taking explicit action.
  5959.  
  5960. @deffn Table @code{base-production} u m -> n
  5961. This table is the basic amount of each material @var{m}
  5962. produced by a unit of type @var{u} in each turn.
  5963. Defaults to @code{0}.
  5964. @end deffn
  5965.  
  5966. @deffn Table @code{occupant-base-production} u m -> n
  5967. This table is the base production of each material @var{m}
  5968. when a unit of type @var{u} is an occupant.
  5969. Defaults to @code{0}.
  5970. @end deffn
  5971.  
  5972. @deffn Table @code{productivity} u t -> n%
  5973. This base is the percentage productivity of a unit
  5974. of type @var{u} when on terrain of type @var{t}.
  5975. This is multiplied with the basic production rate to get actual material
  5976. production, so productivity of @code{0} completely disables production on
  5977. that terrain type, and productivity of @code{100} yields the rate
  5978. specified by @code{base-production}.
  5979. Defaults to @code{100}.
  5980. @end deffn
  5981.  
  5982. @deffn Table @code{productivity-min} u m -> n
  5983. @end deffn
  5984. @deffn Table @code{productivity-max} u m -> n
  5985. These tables are the
  5986. lower and upper bounds on actual production after multiplying by
  5987. productivity.
  5988. Default to @code{0} and @code{9999}, respectively.
  5989. @end deffn
  5990.  
  5991. @deffn Table @code{base-consumption} u m -> n
  5992. This table
  5993. sets the amount of materials consumed by the unit in a turn, even if it
  5994. doesn't move or do anything else.
  5995. Defaults to @code{0}.
  5996. @end deffn
  5997.  
  5998. @deffn Table @code{hp-per-starve} u m -> hp
  5999. If the unit runs out of a material that it must consume,
  6000. this table specifies how many hp it will lose each turn that it is starving.
  6001. If starving for several reasons, loss is max of starvation losses,
  6002. not the sum.
  6003. Defaults to @code{0}.
  6004. @end deffn
  6005.  
  6006. @deffn Table @code{consumption-as-occupant} u m -> n%
  6007. This table is the consumption by a unit of type @var{u1} when it is
  6008. an occupant, expressed as a percentage of its @code{base-consumption}.
  6009. This is useful for units such as planes which always consume fuel
  6010. in the air but not on the ground.
  6011. Defaults to @code{100}.
  6012. @end deffn
  6013.  
  6014. @node Terrain Production and Consumption, Supply Lines, Unit Production and Consumption, Backdrop Economy Parameters
  6015.  
  6016. @subsection Terrain Production and Consumption
  6017.  
  6018. Materials may be produced by cells, redistributed, and also taken up
  6019. by units.  Some amount of material may need to stay in the cell's storage,
  6020. or the type of terrain might change.  Exhaustion is tested after all consumption
  6021. has been accounted for.
  6022.  
  6023. @deffn Table @code{terrain-production} t m -> n
  6024. This table is the amount of each material @var{m} produced by a cell of the given
  6025. type @var{t} in each turn.
  6026. Defaults to @code{0}.
  6027. @end deffn
  6028.  
  6029. @deffn Table @code{terrain-consumption} t m -> n
  6030. This table is the amount of material @var{m} consumed by a cell of type @var{t}
  6031. each turn.
  6032. If insufficient material is available, then the terrain may change type.
  6033. Defaults to @code{0}.
  6034. @end deffn
  6035.  
  6036. @deffn Table @code{change-on-exhaustion-chance} t m -> n%
  6037. This table is the chance that a cell of type @var{t}, with no supply of material
  6038. of type @var{m}, will become exhausted and change to its exhausted type.
  6039. @end deffn
  6040.  
  6041. @deffn Table @code{terrain-exhaustion-type} t1 m -> t2
  6042. If @var{t2} is not @code{non-terrain},
  6043. then this table says that any cell with terrain @var{t1}
  6044. that is exhausted will change to @var{t2}.
  6045. If several materials are
  6046. exhausted in the same turn, then the lowest-numbered material type
  6047. will determine the new terrain type.
  6048. Defaults to @code{non-terrain}.
  6049. @end deffn
  6050.  
  6051. @deffn Table @code{people-consumption} m1 m2 -> n
  6052. This table is the base consumption per turn
  6053. by people of type @var{m1} of each other material type @var{m2}.
  6054. Defaults to @code{0}.
  6055. @end deffn
  6056.  
  6057. @deffn Table @code{people-production} m1 m2 -> n
  6058. This table is the people of type @var{m1} base production per turn
  6059. of each other material type @var{m2}.
  6060. Defaults to @code{0}.
  6061. @end deffn
  6062.  
  6063. @node Supply Lines,  , Terrain Production and Consumption, Backdrop Economy Parameters
  6064.  
  6065. @subsection Supply Lines
  6066.  
  6067. In real life, material production and consumption rarely occur in the same place
  6068. at the same time.
  6069. For some games, the player must transfer materials
  6070. manually, by loading and unloading from units.
  6071. However, this can be time-consuming and difficult,
  6072. and is best reserved for scarce and/or
  6073. valuable materials.
  6074. For more common materials, @i{Xconq} provides @dfn{supply lines}.
  6075.  
  6076. @deffn Table @code{in-length} u1 m -> dist
  6077. @end deffn
  6078. @deffn Table @code{out-length} u2 m -> dist
  6079. These two tables together determine the length of supply lines
  6080. between units.  The given type of material can only be transferred from
  6081. unit type @var{u1} to unit type @var{u2}
  6082. if the distance is less than the minimum of
  6083. the @code{in-length} of @var{u1} and the @code{out-length} of @var{u2}.
  6084. For instance, the @code{in-length} for a fighter's fuel might be 3 cells,
  6085. while the @code{out-length} of fuel from a city is 4 cells.
  6086. Then the fighter will be constantly supplied with fuel
  6087. when within 3 cells of a city.
  6088. If the fighter's out-length is -1, it will never
  6089. transfer any fuel to the city.
  6090. An in- or out-length of @code{0} means that the two units must be
  6091. in the same cell,
  6092. while a negative length disables the automatic transfer completely.
  6093. Long @code{out-length} lines should be used sparingly,
  6094. since the algorithm uses the @code{out-length} to
  6095. define a radius of search for units to be resupplied.
  6096. Both default to @code{0}.
  6097. @end deffn
  6098.  
  6099. @c @node Backdrop Trade, Backdrop Taxation, Supply Lines, Backdrop Economy Parameters
  6100. @c 
  6101. @c @subsection Backdrop Trade
  6102. @c 
  6103. @c [not yet implemented]
  6104. @c 
  6105. @c To move materials automatically between cells,
  6106. @c you must define the demand and supply relationships,
  6107. @c as well as the rate and distance that materials can move.
  6108. @c 
  6109. @c Demand for a material originates with consumption and
  6110. @c construction needs, issuing either from a side or from
  6111. @c some other part of the economy.
  6112. @c 
  6113. @c @node Backdrop Taxation, Material Conversion, Backdrop Trade, Backdrop Economy Parameters
  6114. @c 
  6115. @c @subsection Backdrop Taxation
  6116. @c 
  6117. @c [not yet implemented]
  6118. @c 
  6119. @c A side can set a taxation rate, which is the amount of material
  6120. @c that will be taken from the cell-based economy and given to units
  6121. @c on that side.
  6122. @c 
  6123. @c Taxes may be negative, which will have the effect of returning
  6124. @c materials from units back to cells.
  6125. @c 
  6126. @c Taxation is the last step in economic calculations.
  6127. @c 
  6128. @c @node Material Conversion,  , Backdrop Taxation, Backdrop Economy Parameters
  6129. @c 
  6130. @c @subsection Material Conversion
  6131. @c 
  6132. @c [not yet implemented]
  6133. @c 
  6134. @c Some types of materials can be converted or combined into other types
  6135. @c of materials.
  6136. @c 
  6137.  
  6138. @node Random Events, Dates and Time, Backdrop Economy Parameters, Reference Manual
  6139.  
  6140. @section Random Events
  6141.  
  6142. @deffn GlobalVariable @code{random-events} method-list
  6143. This variable is a list of random event methods
  6144. that will be run at the end of each turn.
  6145. The list is not ordered.
  6146. @end deffn
  6147.  
  6148. @menu
  6149. * Terrain Attrition::           
  6150. * Terrain Accident::            
  6151. * Unit Revolt::                 
  6152. * Unit Surrender::              
  6153. @end menu
  6154.  
  6155. @node Terrain Attrition, Terrain Accident, Random Events, Random Events
  6156.  
  6157. @subsection Terrain Attrition
  6158.  
  6159. Attrition is the automatic loss of hit points due to being in certain types
  6160. of terrain.
  6161.  
  6162. @deffn Method @code{attrition-in-terrain}
  6163. For every unit not in a transport,
  6164. this method computes the chance to lose hit points,
  6165. then damages the unit accordingly.
  6166. This method runs once per turn.
  6167. @end deffn
  6168.  
  6169. @deffn Table @code{attrition} u t -> .01hp
  6170. This table is the rate of loss of hp per turn.
  6171. The terrain used is cell or connection terrain as appropriate for
  6172. the unit's position.
  6173. Defaults to @code{0}.
  6174. @end deffn
  6175.  
  6176. @node Terrain Accident, Unit Revolt, Terrain Attrition, Random Events
  6177.  
  6178. @subsection Terrain Accident
  6179.  
  6180. Accidents result in the damage or disappearance of a unit in the open
  6181. in some kinds of terrain.
  6182.  
  6183. @deffn Method @code{accidents-in-terrain}
  6184. For every unit not in a transport,
  6185. this method computes the chance to be hit or to vanish completely.
  6186. This method runs once per turn.
  6187. @end deffn
  6188.  
  6189. @deffn Table @code{accident-hit-chance} u t -> .01n%
  6190. This table is the chance of the unit being hit while in the given terrain.
  6191. Defaults to @code{0}.
  6192. @end deffn
  6193.  
  6194. @deffn Table @code{accident-damage} u t -> hp
  6195. This table is the hp that will be lost in an accident.
  6196. Defaults to @code{0}.
  6197. @end deffn
  6198.  
  6199. @deffn Table @code{accident-vanish-chance} u t -> .01n%
  6200. This table is the chance of the unit simply vanishing while in the given terrain.
  6201. Defaults to @code{0}.
  6202. @end deffn
  6203.  
  6204. @node Unit Revolt, Unit Surrender, Terrain Accident, Random Events
  6205.  
  6206. @subsection Unit Revolt
  6207.  
  6208. Revolt is a spontaneous change of side,
  6209. occurring in place of a side-given unit action.
  6210. The new side may be none (independence) or another side.
  6211.  
  6212. @deffn Method @code{units-revolt}
  6213. For each completed unit, this method decides whether the unit revolts,
  6214. then changes its side.
  6215. @end deffn
  6216.  
  6217. @deffn UnitTypeProperty @code{revolt-chance} .01n%
  6218. This property is the chance for the unit to revolt spontaneously.
  6219. Defaults to @code{0}.
  6220. @end deffn
  6221.  
  6222. @node Unit Surrender, , Unit Revolt, Random Events
  6223.  
  6224. @subsection Unit Surrender
  6225.  
  6226. @deffn Method @code{units-surrender}
  6227. For each completed unit, this method checks whether the unit will surrender
  6228. to a nearby unfriendly unit.
  6229. @end deffn
  6230.  
  6231. @deffn Table @code{surrender-chance} u1 u2 -> .01n%
  6232. This table is the chance that a unit of type @var{u1} will change its side
  6233. to match the side of a unit @var{u2} that is within the @code{surrender-range}
  6234. for the two types.
  6235. Defaults to @code{0}.
  6236. @end deffn
  6237.  
  6238. @deffn Table @code{surrender-range} u1 u2 -> dist
  6239. This table is the distance out to which a unit of type @var{u1}
  6240. will surrender to a unit of type @var{u2}.
  6241. Defaults to @code{1}.
  6242. @end deffn
  6243.  
  6244. @node Dates and Time, Image Families, Random Events, Reference Manual
  6245.  
  6246. @section Dates and Time
  6247.  
  6248. @deffn GlobalVariable @code{turn} n
  6249. This variable is the number of the current turn.
  6250. Defaults to @code{0}.
  6251. @end deffn
  6252.  
  6253. Note that the first turn of a game is actually turn 1.
  6254. Pre-game activities happen during ``turn 0''.
  6255.  
  6256. @menu
  6257. * Game Length::
  6258. * Calendar::
  6259. * Real Time::                   
  6260. @end menu
  6261.  
  6262. @node Game Length, Calendar, Dates and Time, Dates and Time
  6263.  
  6264. @subsection Game Length
  6265.  
  6266. @deffn GlobalVariable @code{last-turn} n
  6267. This variable is the number
  6268. of the last turn.
  6269. Defaults to @code{-1}, which means that there is no limit on the number
  6270. of turns.
  6271. @end deffn
  6272.  
  6273. @deffn GlobalVariable @code{extra-turn-chance} n%
  6274. This variable is the chance that the game will go one more turn
  6275. after the @code{last-turn}.
  6276. @end deffn
  6277.  
  6278. @i{Xconq} is currently limited to games of 32,767 turns.
  6279.  
  6280. @node Calendar, Real Time, Game Length, Dates and Time
  6281.  
  6282. @subsection Calendar
  6283.  
  6284. You can make @i{Xconq} display game time as a calendar date,
  6285. rather than as a simple turn number.
  6286.  
  6287. @deffn GlobalVariable @code{calendar} type data@dots{}
  6288. This variable is the description of the calendar type that will be used.
  6289. If @code{none}, then turns will be reported numerically starting
  6290. from @code{1}.  If @code{usual}, then the standard Gregorian
  6291. calendar will be used.
  6292. (Other calendars may be supported in the future.)
  6293. Defaults to @code{()}, which is equivalent to @code{(number "turn")}.
  6294.  
  6295. For the @code{usual} calendar, the @var{data} defines how long a turn is,
  6296. in terms of the calendar.
  6297. For instance, a time measure of @code{"day"}
  6298. (and a base date of @code{"1 Jan 1900"}) will result in turns
  6299. @code{"1 Jan 1900"}, @code{"2 Jan 1900"}, etc,
  6300. while a date unit of @code{"year"}
  6301. will yield just @code{"1900"}, @code{"1901"}, and so forth.
  6302.  
  6303. If the numeric or @code{number} calendar is in use, then a @var{data} of @code{"day"}
  6304. will yield @code{"day 1"}, @code{"day 2"}, etc.
  6305.  
  6306. The rest of this variable lists the name of each season
  6307. and the turns within a year for which it is appropriate.
  6308. A twelve-turn year with four seasons could be
  6309. @example
  6310. ((0 2 "winter") (3 5 "spring") (6 8 "summer") (9 11 "autumn"))
  6311. @end example
  6312. If any number ranges overlap, then the first match will be used,
  6313. while if a particular turn has no named season, then it will go
  6314. unnamed in the display.
  6315. @end deffn
  6316.  
  6317. @deffn Symbol @code{none}
  6318. @end deffn
  6319. @deffn Symbol @code{usual}
  6320. @end deffn
  6321.  
  6322. @deffn GlobalVariable @code{initial-date} str
  6323. This variable is the date, in the specified calendar system, of the first turn.
  6324. Defaults to @code{""}, which has the effect of setting the initial date
  6325. to be whatever the calendar does with turn number 1.
  6326. @end deffn
  6327.  
  6328. @node Real Time, , Calendar, Dates and Time
  6329.  
  6330. @subsection Real Time
  6331.  
  6332. A game may also be limited in real time.
  6333.  
  6334. @deffn GlobalVariable @code{real-time-for-game} seconds
  6335. @end deffn
  6336.  
  6337. @deffn GlobalVariable @code{real-time-per-turn} seconds
  6338. @end deffn
  6339.  
  6340. @deffn GlobalVariable @code{real-time-per-side} seconds
  6341. @end deffn
  6342.  
  6343. @deffn GlobalVariable @code{elapsed-real-time} seconds
  6344. This is the difference in real time between the start of the game
  6345. and its current state.
  6346. @end deffn
  6347.  
  6348. @node Image Families, Other Forms, Dates and Time, Reference Manual
  6349.  
  6350. @section Image Families
  6351.  
  6352. The @code{imf} form defines graphical images in a
  6353. platform-independent way.
  6354. An @i{image family} is a named collection of images of varying
  6355. sizes and depths.
  6356.  
  6357. @deffn Form @code{imf} name [ properties ] [ images ]
  6358. This form declares an image family to exist, with the name @var{name}
  6359. and @var{properties}, and consisting of the specified @var{images}.
  6360. Each image has the form
  6361. @code{((@var{w} @var{h} [tile]) [@var{properties}] (@var{type} @var{data}...) ...)},
  6362. where @var{w} and @var{h} are its width and height, respectively,
  6363. the @var{type} may be one of @code{color}, @code{mono}, or @code{mask},
  6364. and the @var{data} consists of strings of hexadecimal digits.
  6365. The data strings may include slashes, which have no effect on interpretation,
  6366. but are useful to indicate each row of an image.
  6367. Color images may also have additional properties, which come between the
  6368. @var{type} and the @var{data}.
  6369.  
  6370. The family's @var{name} may consist only of alphabetic characters,
  6371. decimal digits, and hyphens or underscores.  Upper- and lower-case
  6372. characters are equivalent, as are hyphens and underscores.  The
  6373. canonical form of the name is lowercase with hyphens.
  6374.  
  6375. Multiple forms with the same name may occur, and each adds to the family,
  6376. overwriting individual image parts that are of the same size and depth.
  6377.  
  6378. @end deffn
  6379.  
  6380. @deffn Symbol @code{tile}
  6381. If this symbol appears following the dimensions of an image,
  6382. it indicates that the image is a pattern tile rather than a single image.
  6383. @end deffn
  6384.  
  6385. @deffn ImageProperty @code{actual} w h
  6386. This property is the actual size of the image data.
  6387. @end deffn
  6388.  
  6389. @deffn ImageProperty @code{embed} name
  6390. This property specifies that another image, similar to the image family
  6391. named by @var{name}, is already embedded within the image, and so @i{Xconq}
  6392. need not superimpose such an image itself.  This may occur when an image
  6393. has a ``builtin'' side emblem, or is readily identifiable as belonging
  6394. to a particular side, and it would be redundant for @i{Xconq} to add an
  6395. emblem when displaying a unit.
  6396. @end deffn
  6397.  
  6398. @deffn ImageProperty @code{embed-at} x y
  6399. This property specifies that the area of the image at @i{x,y} is suitable
  6400. for the display of an emblem.
  6401. @end deffn
  6402.  
  6403. @deffn ImageProperty @code{embed-size} w h
  6404. This property specifies the dimensions of the area available for an
  6405. emblem.
  6406. @end deffn
  6407.  
  6408. @deffn ImageProperty @code{mono} data @dots{}
  6409. This property indicates that the data represents a monochrome image.
  6410. @end deffn
  6411.  
  6412. @deffn ImageProperty @code{mask} data @dots{}
  6413. This property indicates that the data represents a mask.
  6414. @end deffn
  6415.  
  6416. @deffn ImageProperty @code{color} [ properties ] data @dots{}
  6417. This property indicates that the data represents a color image.
  6418. @end deffn
  6419.  
  6420. @deffn ColorImageProperty @code{pixel-size} n
  6421. This property is the number of bits used to encode each pixel.
  6422. @end deffn
  6423.  
  6424. @deffn ColorImageProperty @code{row-bytes} n
  6425. This property is the number of bytes in each row of the image.
  6426. @end deffn
  6427.  
  6428. @deffn ColorImageProperty @code{palette} [ name | (index r g b) @dots{} ]
  6429. This property is the color palette that should be used with the image.
  6430. @end deffn
  6431.  
  6432. @deffn Form @code{palette} name (index r g b) @dots{}
  6433. This form defines a palette with the given @var{name}.
  6434. @end deffn
  6435.  
  6436. @deffn Form @code{color} name r g b
  6437. This form names the color.
  6438. @end deffn
  6439.  
  6440. Note that for the purposes of stability and change tracking,
  6441. tools that generate image families use a more restricted format.
  6442. This format requires a separate imf form for each size of image,
  6443. the size is on the same line as the imf name, and each image/mask
  6444. is on a separate line, indented by 2. (See the existing library imf
  6445. files for further detail.)
  6446.  
  6447. @node Other Forms, Files and Directories, Image Families, Reference Manual
  6448.  
  6449. @section Other Forms
  6450.  
  6451. GDL forms in this section are those that do not really fit anywhere
  6452. else.
  6453.  
  6454. @menu
  6455. * Default Display Style::
  6456. * The Random State::
  6457. * Debugging Support::                   
  6458. @end menu
  6459.  
  6460. @deffn UnitTypeProperty @code{name-internal} str
  6461. Internally used type name.
  6462. @end deffn
  6463.  
  6464. @node Default Display Style, The Random State, , Other Forms
  6465.  
  6466. @subsection Default Display Style
  6467.  
  6468. The exact style of display depends on the user interface and
  6469. on user preferences,
  6470. but for some games, you may want to encourage a particular style
  6471. by making it be the default.
  6472.  
  6473. @deffn GlobalVariable @code{unseen-char} str
  6474. This variable is a string whose first character will be used to
  6475. represent unexplored terrain.
  6476. If the string consists of two characters, the second char will be
  6477. scattered throughout a field of the first char.
  6478. Defaults to @code{""}.
  6479. @end deffn
  6480.  
  6481. @deffn GlobalVariable @code{unseen-color} str
  6482. This variable is the name of a color that will be used to
  6483. represent unexplored terrain.
  6484. Defaults to @code{""}.
  6485. @end deffn
  6486.  
  6487. @deffn GlobalVariable @code{unseen-image-name} str
  6488. This variable is the name of an image that will be used to
  6489. represent unexplored terrain.
  6490. Defaults to @code{""}.
  6491. @end deffn
  6492.  
  6493. @deffn GlobalVariable @code{grid-color} str
  6494. This variable is the name of a color to use to draw the
  6495. cell-separating grid.
  6496. Defaults to @code{""}.
  6497. @end deffn
  6498.  
  6499. @node The Random State, Debugging Support, Default Display Style, Other Forms
  6500.  
  6501. @subsection The Random State
  6502.  
  6503. It is useful to be able to restart the random number generator
  6504. consistently.
  6505.  
  6506. @deffn GlobalVariable @code{random-state} n
  6507. This variable is the state of the random number generator.
  6508. If this is not used, then the initial state of the random number
  6509. generator will be set in a system-dependent way.
  6510. @end deffn
  6511.  
  6512. @node Debugging Support,  , The Random State, Other Forms
  6513.  
  6514. @subsection Debugging Support
  6515.  
  6516. @deffn Form @code{print} value
  6517. This form prints to a console or file (depending on the interface)
  6518. the object @var{value}, in GDL syntax.
  6519. @end deffn
  6520.  
  6521. @node Files and Directories,  , Other Forms, Reference Manual
  6522.  
  6523. @section Files and Directories
  6524.  
  6525. This section defines file and directory structure for using GDL.  This is not required;
  6526. for instance, an implementation may choose to handle GDL by reading it from strings
  6527. compiled into the program.  However, the standard @i{Xconq} library and implementation
  6528. does adhere to the conventions described here.
  6529.  
  6530. A game module is a set of forms in a text file, which has an extension of @code{.g}.
  6531.  
  6532. By convention, the first form in the file is a @code{game-module} form that defines
  6533. properties of the module.  If the interface has any sort of preview for a particular
  6534. module, it can then read only the first form, rather than the entire file.
  6535.  
  6536. Some interfaces include a game selection dialog, which lists a set of games from which
  6537. to choose, along with a little information about each.  The file @code{game.dir} in
  6538. the library directory contains this list, which is simply a list of module name strings:
  6539. @example
  6540. (  ;; games that should appear in new game selection dialogs
  6541. "1756"
  6542. "cave"
  6543. "cherbourg"
  6544. "classic"
  6545. "coral-sea"
  6546. "crater-lake"
  6547. )
  6548. @end example
  6549.  
  6550. @i{Xconq} does not currently enforce any sort of standard on file names,
  6551. but for maximum portability, the file name should not include mixed case,
  6552. it should consist only of alphabetic and numeric characters and hyphen,
  6553. and should be less than 12 characters in length, with 8 of those distinct
  6554. from any other name in the same directory.  Since @i{Xconq} implementations
  6555. typically use the file name as a way to find modules,
  6556. these restrictions should apply to module names as well.
  6557.  
  6558. Image files are library files with the extension @code{.imf}.  Usually each image
  6559. file contains a group of images related in some way, perhaps by a common theme
  6560. or by use in a particular game. @i{Xconq} implementations find images either by
  6561. a method specific to the platform (such as resource files), or by looking up the
  6562. image's location in the image directory @code{imf.dir}.
  6563. The image directory is just a set of pairs of image name and imf file, with markers
  6564. at beginning and end of the file:
  6565. @example
  6566. ImageFamilyName FileName
  6567. amulet fantasy.imf
  6568. ant insects.imf
  6569. anvil-and-crown fantasy.imf
  6570. ap standard.imf
  6571. archer ancient.imf
  6572. . .
  6573. @end example
  6574. Note that while @code{game.dir} is a GDL-syntax form, @code{imf.dir} is not.
  6575. It should rarely be necessary to modify @code{imf.dir} directly; the scripts
  6576. @code{makedir.sh} and @code{makedir.pl} in the standard library directory
  6577. are Unix shell and Perl scripts, each of which will generate @code{imf.dir} from a
  6578. given list of files, such as @code{*.imf} in the library.  You should run
  6579. one of these after adding to a library image file.
  6580.  
  6581.